From ee8062fece514e7ee0eede03d939c4afa3bb18d9 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 23 Jun 2013 23:44:16 +0100 Subject: [PATCH] Working toward PSR-2 standards --- Classes/Autoloader.php | 30 +++++++++---------- Classes/Bootstrap.php | 2 +- Classes/PHPExcel/CachedObjectStorage/APC.php | 2 +- .../PHPExcel/CachedObjectStorage/ICache.php | 2 +- .../PHPExcel/CachedObjectStorageFactory.php | 2 +- .../CalcEngine/CyclicReferenceStack.php | 2 +- Classes/PHPExcel/CalcEngine/Logger.php | 14 ++++----- Classes/PHPExcel/Calculation/Financial.php | 14 ++++----- Classes/PHPExcel/Calculation/Function.php | 2 +- Classes/PHPExcel/Calculation/TextData.php | 2 +- Classes/PHPExcel/Cell.php | 2 +- Classes/PHPExcel/IComparable.php | 2 +- Classes/PHPExcel/Reader/Excel2003XML.php | 2 +- Classes/PHPExcel/Shared/OLERead.php | 2 +- Classes/PHPExcel/Shared/String.php | 2 +- Classes/PHPExcel/Shared/XMLWriter.php | 2 +- Classes/PHPExcel/Shared/ZipArchive.php | 2 +- Classes/PHPExcel/Workbook.php | 2 +- Classes/PHPExcel/Worksheet.php | 8 ++--- Classes/PHPExcel/Writer/Excel2007/Theme.php | 4 +-- Classes/PHPExcel/Writer/Excel5/Escher.php | 12 ++++---- Classes/PHPExcel/Writer/HTML.php | 8 ++--- Classes/PHPExcel/Writer/PDF.php | 8 ++--- 23 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Classes/Autoloader.php b/Classes/Autoloader.php index 1df3bea..6bc5e1c 100644 --- a/Classes/Autoloader.php +++ b/Classes/Autoloader.php @@ -44,7 +44,7 @@ namespace PHPExcel; - + /** * PHPExcel\Autoloader * @@ -58,11 +58,11 @@ class Autoloader private $namespace; private $includePath; private $namespaceSeparator = '\\'; - + /** * Creates a new SplClassLoader that loads classes of the * specified namespace. - * + * * @param string $namespace The namespace to use. * @param string $includePath The directory path for that namespace. */ @@ -71,17 +71,17 @@ class Autoloader $this->namespace = $namespace; $this->includePath = $includePath; } - + /** * Sets the namespace separator used by classes in the namespace of this class loader. - * + * * @param string $sep The separator to use. */ public function setNamespaceSeparator($sep) { $this->namespaceSeparator = $sep; } - + /** * Gets the namespace seperator used by classes in the namespace of this class loader. * @@ -91,17 +91,17 @@ class Autoloader { return $this->namespaceSeparator; } - + /** * Sets the base include path for all class files in the namespace of this class loader. - * + * * @param string $includePath */ public function setIncludePath($includePath) { $this->includePath = $includePath; } - + /** * Gets the base include path for all class files in the namespace of this class loader. * @@ -111,17 +111,17 @@ class Autoloader { return $this->includePath; } - + /** * Sets the file extension of class files in the namespace of this class loader. - * + * * @param string $fileExtension */ public function setFileExtension($fileExtension) { $this->fileExtension = $fileExtension; } - + /** * Gets the file extension of class files in the namespace of this class loader. * @@ -131,7 +131,7 @@ class Autoloader { return $this->fileExtension; } - + /** * Installs this class loader on the SPL autoload stack. */ @@ -139,7 +139,7 @@ class Autoloader { spl_autoload_register(array($this, 'loadClass')); } - + /** * Uninstalls this class loader from the SPL autoloader stack. */ @@ -147,7 +147,7 @@ class Autoloader { spl_autoload_unregister(array($this, 'loadClass')); } - + /** * Loads the given class or interface. * diff --git a/Classes/Bootstrap.php b/Classes/Bootstrap.php index 6e4b997..9769bbd 100644 --- a/Classes/Bootstrap.php +++ b/Classes/Bootstrap.php @@ -26,7 +26,7 @@ */ namespace PHPExcel; - + /** PHPOffice root directory */ if (!defined('PHPEXCEL_ROOT')) { define('PHPEXCEL_ROOT', dirname(__FILE__)); diff --git a/Classes/PHPExcel/CachedObjectStorage/APC.php b/Classes/PHPExcel/CachedObjectStorage/APC.php index c7613c0..ca96251 100644 --- a/Classes/PHPExcel/CachedObjectStorage/APC.php +++ b/Classes/PHPExcel/CachedObjectStorage/APC.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\CachedObjectStorage_APC * diff --git a/Classes/PHPExcel/CachedObjectStorage/ICache.php b/Classes/PHPExcel/CachedObjectStorage/ICache.php index aeb8077..964681c 100644 --- a/Classes/PHPExcel/CachedObjectStorage/ICache.php +++ b/Classes/PHPExcel/CachedObjectStorage/ICache.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\CachedObjectStorage_ICache * diff --git a/Classes/PHPExcel/CachedObjectStorageFactory.php b/Classes/PHPExcel/CachedObjectStorageFactory.php index f82ad43..f7bfec2 100644 --- a/Classes/PHPExcel/CachedObjectStorageFactory.php +++ b/Classes/PHPExcel/CachedObjectStorageFactory.php @@ -28,7 +28,7 @@ namespace PHPExcel; - + /** * PHPExcel\CachedObjectStorageFactory * diff --git a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php index 95d495e..8a4467b 100644 --- a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php +++ b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\CalcEngine_CyclicReferenceStack * diff --git a/Classes/PHPExcel/CalcEngine/Logger.php b/Classes/PHPExcel/CalcEngine/Logger.php index e98f06f..d66b2f2 100644 --- a/Classes/PHPExcel/CalcEngine/Logger.php +++ b/Classes/PHPExcel/CalcEngine/Logger.php @@ -26,7 +26,7 @@ */ namespace PHPExcel; - + /** * PHPExcel\CalcEngine_Logger * @@ -69,7 +69,7 @@ class CalcEngine_Logger { */ private $_cellStack; - + /** * Instantiate a Calculation engine logger * @@ -124,13 +124,13 @@ class CalcEngine_Logger { $message = implode(func_get_args()); $cellReference = implode(' -> ', $this->_cellStack->showStack()); if ($this->_echoDebugLog) { - echo $cellReference, - ($this->_cellStack->count() > 0 ? ' => ' : ''), - $message, + echo $cellReference, + ($this->_cellStack->count() > 0 ? ' => ' : ''), + $message, PHP_EOL; } - $this->_debugLog[] = $cellReference . - ($this->_cellStack->count() > 0 ? ' => ' : '') . + $this->_debugLog[] = $cellReference . + ($this->_cellStack->count() > 0 ? ' => ' : '') . $message; } } diff --git a/Classes/PHPExcel/Calculation/Financial.php b/Classes/PHPExcel/Calculation/Financial.php index 050ee22..c1bf452 100644 --- a/Classes/PHPExcel/Calculation/Financial.php +++ b/Classes/PHPExcel/Calculation/Financial.php @@ -1309,10 +1309,10 @@ class Calculation_Financial { /** * IRR * - * Returns the internal rate of return for a series of cash flows represented by the numbers in values. - * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur + * Returns the internal rate of return for a series of cash flows represented by the numbers in values. + * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur * at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received - * for an investment consisting of payments (negative values) and income (positive values) that occur at regular + * for an investment consisting of payments (negative values) and income (positive values) that occur at regular * periods. * * Excel Function: @@ -1320,7 +1320,7 @@ class Calculation_Financial { * * @param float[] $values An array or a reference to cells that contain numbers for which you want * to calculate the internal rate of return. - * Values must contain at least one positive value and one negative value to + * Values must contain at least one positive value and one negative value to * calculate the internal rate of return. * @param float $guess A number that you guess is close to the result of IRR * @return float @@ -1358,9 +1358,9 @@ class Calculation_Financial { $dx *= 0.5; $x_mid = $rtb + $dx; $f_mid = self::NPV($x_mid, $values); - if ($f_mid <= 0.0) + if ($f_mid <= 0.0) $rtb = $x_mid; - if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) + if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid; } return Calculation_Functions::VALUE(); @@ -1411,7 +1411,7 @@ class Calculation_Financial { /** * MIRR * - * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both + * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both * the cost of the investment and the interest received on reinvestment of cash. * * Excel Function: diff --git a/Classes/PHPExcel/Calculation/Function.php b/Classes/PHPExcel/Calculation/Function.php index a0763cb..0795568 100644 --- a/Classes/PHPExcel/Calculation/Function.php +++ b/Classes/PHPExcel/Calculation/Function.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\Calculation_Function * diff --git a/Classes/PHPExcel/Calculation/TextData.php b/Classes/PHPExcel/Calculation/TextData.php index 354e96b..278f054 100644 --- a/Classes/PHPExcel/Calculation/TextData.php +++ b/Classes/PHPExcel/Calculation/TextData.php @@ -482,7 +482,7 @@ class Calculation_TextData { * @param string $oldText String to modify * @param int $start Start character * @param int $chars Number of characters - * @param string $newText String to replace in defined position + * @param string $newText String to replace in defined position * @return string */ public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) { diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index b4a83e5..8fb2ebb 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\Cell * diff --git a/Classes/PHPExcel/IComparable.php b/Classes/PHPExcel/IComparable.php index 4fd945c..8cd7b85 100644 --- a/Classes/PHPExcel/IComparable.php +++ b/Classes/PHPExcel/IComparable.php @@ -25,7 +25,7 @@ namespace PHPExcel; - + /** * PHPExcel\IComparable * diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index 03cf700..8739010 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -88,7 +88,7 @@ class Reader_Excel2003XML extends Reader_Abstract implements Reader_IReader // Open file $this->_openFile($pFilename); $fileHandle = $this->_fileHandle; - + // Read sample data (first 2 KB will do) $data = fread($fileHandle, 2048); fclose($fileHandle); diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php index 50157b3..4ac94d8 100644 --- a/Classes/PHPExcel/Shared/OLERead.php +++ b/Classes/PHPExcel/Shared/OLERead.php @@ -25,7 +25,7 @@ * @version ##VERSION##, ##DATE## */ - + namespace PHPExcel; defined('IDENTIFIER_OLE') || diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index 2735327..15f24c7 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\Shared_String * diff --git a/Classes/PHPExcel/Shared/XMLWriter.php b/Classes/PHPExcel/Shared/XMLWriter.php index 9180a9d..cc28a3c 100644 --- a/Classes/PHPExcel/Shared/XMLWriter.php +++ b/Classes/PHPExcel/Shared/XMLWriter.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + if (!defined('DATE_W3C')) { define('DATE_W3C', 'Y-m-d\TH:i:sP'); } diff --git a/Classes/PHPExcel/Shared/ZipArchive.php b/Classes/PHPExcel/Shared/ZipArchive.php index 3b5610b..2211f87 100644 --- a/Classes/PHPExcel/Shared/ZipArchive.php +++ b/Classes/PHPExcel/Shared/ZipArchive.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + if (!defined('PCLZIP_TEMPORARY_DIR')) { define('PCLZIP_TEMPORARY_DIR', Shared_File::sys_get_temp_dir()); } diff --git a/Classes/PHPExcel/Workbook.php b/Classes/PHPExcel/Workbook.php index 46acdec..d56f2fa 100644 --- a/Classes/PHPExcel/Workbook.php +++ b/Classes/PHPExcel/Workbook.php @@ -26,7 +26,7 @@ */ namespace PHPExcel; - + /** * PHPExcel * diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 41424f9..eb96a15 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -27,7 +27,7 @@ namespace PHPExcel; - + /** * PHPExcel\Worksheet * @@ -1165,8 +1165,8 @@ class Worksheet implements IComparable $cell = $this->_cellCollection->addCacheData( $pCoordinate, new Cell( - null, - Cell_DataType::TYPE_NULL, + null, + Cell_DataType::TYPE_NULL, $this ) ); @@ -1193,7 +1193,7 @@ class Worksheet implements IComparable return $cell; } - + /** * Does the cell at a specific coordinate exist? * diff --git a/Classes/PHPExcel/Writer/Excel2007/Theme.php b/Classes/PHPExcel/Writer/Excel2007/Theme.php index 720752e..06e8f1a 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Theme.php +++ b/Classes/PHPExcel/Writer/Excel2007/Theme.php @@ -130,7 +130,7 @@ class Writer_Excel2007_Theme extends Writer_Excel2007_WriterPart 'hlink' => '0000FF', 'folHlink' => '800080', ); - + /** * Write theme to XML format * @@ -868,6 +868,6 @@ class Writer_Excel2007_Theme extends Writer_Excel2007_WriterPart $objWriter->endElement(); } - + } } diff --git a/Classes/PHPExcel/Writer/Excel5/Escher.php b/Classes/PHPExcel/Writer/Excel5/Escher.php index 767e4c4..3f6fc9b 100644 --- a/Classes/PHPExcel/Writer/Excel5/Escher.php +++ b/Classes/PHPExcel/Writer/Excel5/Escher.php @@ -60,7 +60,7 @@ class Writer_Excel5_Escher * @var array */ private $_spTypes; - + /** * Constructor * @@ -317,7 +317,7 @@ class Writer_Excel5_Escher // get the shape offsets relative to the spgrContainer record $spOffsets = $writer->getSpOffsets(); $spTypes = $writer->getSpTypes(); - + // save the shape offsets relative to dgContainer foreach ($spOffsets as & $spOffset) { $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes) @@ -361,7 +361,7 @@ class Writer_Excel5_Escher // save the shape offsets (where new shape records begin) $totalSize += strlen($spData); $spOffsets[] = $totalSize; - + $spTypes = array_merge($spTypes, $writer->getSpTypes()); } @@ -469,7 +469,7 @@ class Writer_Excel5_Escher $clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY); - + $length = strlen($clientAnchorData); $recVerInstance = $recVer; @@ -534,6 +534,6 @@ class Writer_Excel5_Escher { return $this->_spTypes; } - - + + } diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index 52f4a57..aaa2a5a 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -966,9 +966,9 @@ class Writer_HTML extends Writer_Abstract implements Writer_IWriter { private function _createCSSStyleBorder(Style_Border $pStyle) { // Create CSS // $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); - // Create CSS - add !important to non-none border styles for merged cells - $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); - $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); + // Create CSS - add !important to non-none border styles for merged cells + $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); + $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); // Return return $css; @@ -1019,7 +1019,7 @@ class Writer_HTML extends Writer_Abstract implements Writer_IWriter { // Construct HTML $html = ''; $html .= $this->_setMargins($pSheet); - + if (!$this->_useInlineCss) { $gridlines = $pSheet->getShowGridLines() ? ' gridlines' : ''; $html .= ' ' . PHP_EOL; diff --git a/Classes/PHPExcel/Writer/PDF.php b/Classes/PHPExcel/Writer/PDF.php index daa621c..5404405 100644 --- a/Classes/PHPExcel/Writer/PDF.php +++ b/Classes/PHPExcel/Writer/PDF.php @@ -43,7 +43,7 @@ class Writer_PDF * * @var PHPExcel\Writer_PDF_Core */ - private $_renderer = null; + private $renderer = null; /** * Instantiate a new renderer of the configured type within this container class @@ -69,7 +69,7 @@ class Writer_PDF } $rendererName = __NAMESPACE__ . '\Writer_PDF_' . $pdfLibraryName; - $this->_renderer = new $rendererName($phpExcel); + $this->renderer = new $rendererName($phpExcel); } @@ -82,10 +82,10 @@ class Writer_PDF */ public function __call($name, $arguments) { - if ($this->_renderer === null) { + if ($this->renderer === null) { throw new Writer_Exception("PDF Rendering library has not been defined."); } - return call_user_func_array(array($this->_renderer, $name), $arguments); + return call_user_func_array(array($this->renderer, $name), $arguments); } }