Yet more of the psr-2 work

This commit is contained in:
MarkBaker 2015-05-16 23:18:40 +01:00
parent 4c8dd00dff
commit 61e81377cb
10 changed files with 7225 additions and 7203 deletions

View File

@ -271,11 +271,13 @@ class PHPExcel_Calculation
// PHPExcel functions
private static $PHPExcelFunctions = array( // PHPExcel functions
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'ABS' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs',
'argumentCount' => '1'
argumentCount' => '1'
),
'ACCRINT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
'ACCRINT' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT',
'argumentCount' => '4-7'
),
@ -1697,7 +1699,8 @@ class PHPExcel_Calculation
'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT',
'argumentCount' => '5,6'
),
'ZTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
'ZTEST' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST',
'argumentCount' => '2-3'
)
@ -1739,7 +1742,7 @@ class PHPExcel_Calculation
}
}
private static function _loadLocales()
private static function loadLocales()
{
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
@ -1981,7 +1984,7 @@ class PHPExcel_Calculation
}
if (count(self::$validLocaleLanguages) == 1) {
self::_loadLocales();
self::loadLocales();
}
// Test whether we have any language data for this language (any locale)
if (in_array($language, self::$validLocaleLanguages)) {

View File

@ -41,7 +41,7 @@ class PHPExcel_Chart_Legend
const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr';
private static $_positionXLref = array(
private static $positionXLref = array(
self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??',
@ -99,7 +99,7 @@ class PHPExcel_Chart_Legend
*/
public function setPosition($position = self::POSITION_RIGHT)
{
if (!in_array($position, self::$_positionXLref)) {
if (!in_array($position, self::$positionXLref)) {
return false;
}
@ -114,7 +114,7 @@ class PHPExcel_Chart_Legend
*/
public function getPositionXL()
{
return array_search($this->position, self::$_positionXLref);
return array_search($this->position, self::$positionXLref);
}
/**
@ -124,11 +124,11 @@ class PHPExcel_Chart_Legend
*/
public function setPositionXL($positionXL = self::xlLegendPositionRight)
{
if (!array_key_exists($positionXL, self::$_positionXLref)) {
if (!array_key_exists($positionXL, self::$positionXLref)) {
return false;
}
$this->position = self::$_positionXLref[$positionXL];
$this->position = self::$positionXLref[$positionXL];
return true;
}

View File

@ -535,7 +535,7 @@ class PHPExcel_DocumentProperties
return strtotime($propertyValue);
break;
case 'bool': // Boolean
return ($propertyValue == 'true') ? True : False;
return ($propertyValue == 'true') ? true : false;
break;
case 'cy': // Currency
case 'error': // Error Status Code
@ -556,7 +556,8 @@ class PHPExcel_DocumentProperties
return $propertyValue;
}
public static function convertPropertyType($propertyType) {
public static function convertPropertyType($propertyType)
{
switch ($propertyType) {
case 'i1': // 1-Byte Signed Integer
case 'i2': // 2-Byte Signed Integer
@ -607,5 +608,4 @@ class PHPExcel_DocumentProperties
}
return self::PROPERTY_TYPE_UNKNOWN;
}
}

View File

@ -32,35 +32,35 @@ class PHPExcel_DocumentSecurity
*
* @var boolean
*/
private $_lockRevision;
private $lockRevision;
/**
* LockStructure
*
* @var boolean
*/
private $_lockStructure;
private $lockStructure;
/**
* LockWindows
*
* @var boolean
*/
private $_lockWindows;
private $lockWindows;
/**
* RevisionsPassword
*
* @var string
*/
private $_revisionsPassword;
private $revisionsPassword;
/**
* WorkbookPassword
*
* @var string
*/
private $_workbookPassword;
private $workbookPassword;
/**
* Create a new PHPExcel_DocumentSecurity
@ -68,11 +68,11 @@ class PHPExcel_DocumentSecurity
public function __construct()
{
// Initialise values
$this->_lockRevision = false;
$this->_lockStructure = false;
$this->_lockWindows = false;
$this->_revisionsPassword = '';
$this->_workbookPassword = '';
$this->lockRevision = false;
$this->lockStructure = false;
$this->lockWindows = false;
$this->revisionsPassword = '';
$this->workbookPassword = '';
}
/**
@ -82,9 +82,9 @@ class PHPExcel_DocumentSecurity
*/
public function isSecurityEnabled()
{
return $this->_lockRevision ||
$this->_lockStructure ||
$this->_lockWindows;
return $this->lockRevision ||
$this->lockStructure ||
$this->lockWindows;
}
/**
@ -94,7 +94,7 @@ class PHPExcel_DocumentSecurity
*/
public function getLockRevision()
{
return $this->_lockRevision;
return $this->lockRevision;
}
/**
@ -105,7 +105,7 @@ class PHPExcel_DocumentSecurity
*/
public function setLockRevision($pValue = false)
{
$this->_lockRevision = $pValue;
$this->lockRevision = $pValue;
return $this;
}
@ -116,7 +116,7 @@ class PHPExcel_DocumentSecurity
*/
public function getLockStructure()
{
return $this->_lockStructure;
return $this->lockStructure;
}
/**
@ -127,7 +127,7 @@ class PHPExcel_DocumentSecurity
*/
public function setLockStructure($pValue = false)
{
$this->_lockStructure = $pValue;
$this->lockStructure = $pValue;
return $this;
}
@ -138,7 +138,7 @@ class PHPExcel_DocumentSecurity
*/
public function getLockWindows()
{
return $this->_lockWindows;
return $this->lockWindows;
}
/**
@ -149,7 +149,7 @@ class PHPExcel_DocumentSecurity
*/
public function setLockWindows($pValue = false)
{
$this->_lockWindows = $pValue;
$this->lockWindows = $pValue;
return $this;
}
@ -160,7 +160,7 @@ class PHPExcel_DocumentSecurity
*/
public function getRevisionsPassword()
{
return $this->_revisionsPassword;
return $this->revisionsPassword;
}
/**
@ -175,7 +175,7 @@ class PHPExcel_DocumentSecurity
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
$this->_revisionsPassword = $pValue;
$this->revisionsPassword = $pValue;
return $this;
}
@ -186,7 +186,7 @@ class PHPExcel_DocumentSecurity
*/
public function getWorkbookPassword()
{
return $this->_workbookPassword;
return $this->workbookPassword;
}
/**
@ -201,7 +201,7 @@ class PHPExcel_DocumentSecurity
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
$this->_workbookPassword = $pValue;
$this->workbookPassword = $pValue;
return $this;
}

View File

@ -573,7 +573,8 @@ class PHPExcel_Helper_HTML
protected $richTextObject;
protected function initialise() {
protected function initialise()
{
$this->face = $this->size = $this->color = null;
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
@ -582,7 +583,8 @@ class PHPExcel_Helper_HTML
$this->stringData = '';
}
public function toRichTextObject($html) {
public function toRichTextObject($html)
{
$this->initialise();
// Create a new DOM object
@ -594,15 +596,17 @@ class PHPExcel_Helper_HTML
// Discard excess white space
$dom->preserveWhiteSpace = false;
$this->richTextObject = new PHPExcel_RichText();;
$this->richTextObject = new PHPExcel_RichText();
$this->parseElements($dom);
return $this->richTextObject;
}
protected function buildTextRun() {
protected function buildTextRun()
{
$text = $this->stringData;
if (trim($text) === '')
if (trim($text) === '') {
return;
}
$richtextRun = $this->richTextObject->createTextRun($this->stringData);
if ($this->face) {
@ -635,7 +639,8 @@ class PHPExcel_Helper_HTML
$this->stringData = '';
}
protected function rgbToColour($rgb) {
protected function rgbToColour($rgb)
{
preg_match_all('/\d+/', $rgb, $values);
foreach ($values[0] as &$value) {
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
@ -643,11 +648,13 @@ class PHPExcel_Helper_HTML
return implode($values[0]);
}
protected function colourNameLookup($rgb) {
protected function colourNameLookup($rgb)
{
return self::$colourMap[$rgb];
}
protected function startFontTag($tag) {
protected function startFontTag($tag)
{
foreach ($tag->attributes as $attribute) {
$attributeName = strtolower($attribute->name);
$attributeValue = $attribute->value;
@ -666,69 +673,85 @@ class PHPExcel_Helper_HTML
}
}
protected function endFontTag() {
protected function endFontTag()
{
$this->face = $this->size = $this->color = null;
}
protected function startBoldTag() {
protected function startBoldTag()
{
$this->bold = true;
}
protected function endBoldTag() {
protected function endBoldTag()
{
$this->bold = false;
}
protected function startItalicTag() {
protected function startItalicTag()
{
$this->italic = true;
}
protected function endItalicTag() {
protected function endItalicTag()
{
$this->italic = false;
}
protected function startUnderlineTag() {
protected function startUnderlineTag()
{
$this->underline = true;
}
protected function endUnderlineTag() {
protected function endUnderlineTag()
{
$this->underline = false;
}
protected function startSubscriptTag() {
protected function startSubscriptTag()
{
$this->subscript = true;
}
protected function endSubscriptTag() {
protected function endSubscriptTag()
{
$this->subscript = false;
}
protected function startSuperscriptTag() {
protected function startSuperscriptTag()
{
$this->superscript = true;
}
protected function endSuperscriptTag() {
protected function endSuperscriptTag()
{
$this->superscript = false;
}
protected function startStrikethruTag() {
protected function startStrikethruTag()
{
$this->strikethrough = true;
}
protected function endStrikethruTag() {
protected function endStrikethruTag()
{
$this->strikethrough = false;
}
protected function breakTag() {
protected function breakTag()
{
$this->stringData .= PHP_EOL;
}
protected function parseTextNode(DOMText $textNode) {
protected function parseTextNode(DOMText $textNode)
{
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
$this->stringData .= $domText;
$this->buildTextRun();
}
protected function handleCallback($element, $callbackTag, $callbacks) {
protected function handleCallback($element, $callbackTag, $callbacks)
{
if (isset($callbacks[$callbackTag])) {
$elementHandler = $callbacks[$callbackTag];
if (method_exists($this, $elementHandler)) {
@ -737,7 +760,8 @@ class PHPExcel_Helper_HTML
}
}
protected function parseElementNode(DOMElement $element) {
protected function parseElementNode(DOMElement $element)
{
$callbackTag = strtolower($element->nodeName);
$this->stack[] = $callbackTag;
@ -750,7 +774,8 @@ class PHPExcel_Helper_HTML
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
}
protected function parseElements(DOMNode $element) {
protected function parseElements(DOMNode $element)
{
foreach ($element->childNodes as $child) {
if ($child instanceof DOMText) {
$this->parseTextNode($child);

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_OLE_ChainedBlockStream
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,17 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_OLE_ChainedBlockStream
*
* Stream wrapper for reading data stored in an OLE file. Implements methods
* for PHP's stream_wrapper_register(). For creating streams using this
* wrapper, use PHPExcel_Shared_OLE_PPS_File::getStream().
*
* @category PHPExcel
* @package PHPExcel_Shared_OLE
*/
class PHPExcel_Shared_OLE_ChainedBlockStream
{
/**

View File

@ -71,10 +71,14 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
public function save($filename)
{
// Initial Setting for saving
$this->_BIG_BLOCK_SIZE = pow(2,
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9));
$this->_SMALL_BLOCK_SIZE= pow(2,
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6));
$this->_BIG_BLOCK_SIZE = pow(
2,
(isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9
);
$this->_SMALL_BLOCK_SIZE= pow(
2,
(isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE) : 6
);
if (is_resource($filename)) {
$this->_FILEH_ = $filename;

View File

@ -216,8 +216,7 @@
{
// ----- Tests the zlib
if (!function_exists('gzopen'))
{
if (!function_exists('gzopen')) {
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
}
@ -229,6 +228,7 @@
// ----- Return
return;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------