Working toward PSR-2 standards

This commit is contained in:
Mark Baker 2013-06-23 23:44:16 +01:00
parent 1549cc42ca
commit ee8062fece
23 changed files with 64 additions and 64 deletions

View File

@ -44,7 +44,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\Autoloader * PHPExcel\Autoloader
* *
@ -58,11 +58,11 @@ class Autoloader
private $namespace; private $namespace;
private $includePath; private $includePath;
private $namespaceSeparator = '\\'; private $namespaceSeparator = '\\';
/** /**
* Creates a new SplClassLoader that loads classes of the * Creates a new SplClassLoader that loads classes of the
* specified namespace. * specified namespace.
* *
* @param string $namespace The namespace to use. * @param string $namespace The namespace to use.
* @param string $includePath The directory path for that namespace. * @param string $includePath The directory path for that namespace.
*/ */
@ -71,17 +71,17 @@ class Autoloader
$this->namespace = $namespace; $this->namespace = $namespace;
$this->includePath = $includePath; $this->includePath = $includePath;
} }
/** /**
* Sets the namespace separator used by classes in the namespace of this class loader. * Sets the namespace separator used by classes in the namespace of this class loader.
* *
* @param string $sep The separator to use. * @param string $sep The separator to use.
*/ */
public function setNamespaceSeparator($sep) public function setNamespaceSeparator($sep)
{ {
$this->namespaceSeparator = $sep; $this->namespaceSeparator = $sep;
} }
/** /**
* Gets the namespace seperator used by classes in the namespace of this class loader. * Gets the namespace seperator used by classes in the namespace of this class loader.
* *
@ -91,17 +91,17 @@ class Autoloader
{ {
return $this->namespaceSeparator; return $this->namespaceSeparator;
} }
/** /**
* Sets the base include path for all class files in the namespace of this class loader. * Sets the base include path for all class files in the namespace of this class loader.
* *
* @param string $includePath * @param string $includePath
*/ */
public function setIncludePath($includePath) public function setIncludePath($includePath)
{ {
$this->includePath = $includePath; $this->includePath = $includePath;
} }
/** /**
* Gets the base include path for all class files in the namespace of this class loader. * 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; return $this->includePath;
} }
/** /**
* Sets the file extension of class files in the namespace of this class loader. * Sets the file extension of class files in the namespace of this class loader.
* *
* @param string $fileExtension * @param string $fileExtension
*/ */
public function setFileExtension($fileExtension) public function setFileExtension($fileExtension)
{ {
$this->fileExtension = $fileExtension; $this->fileExtension = $fileExtension;
} }
/** /**
* Gets the file extension of class files in the namespace of this class loader. * Gets the file extension of class files in the namespace of this class loader.
* *
@ -131,7 +131,7 @@ class Autoloader
{ {
return $this->fileExtension; return $this->fileExtension;
} }
/** /**
* Installs this class loader on the SPL autoload stack. * Installs this class loader on the SPL autoload stack.
*/ */
@ -139,7 +139,7 @@ class Autoloader
{ {
spl_autoload_register(array($this, 'loadClass')); spl_autoload_register(array($this, 'loadClass'));
} }
/** /**
* Uninstalls this class loader from the SPL autoloader stack. * Uninstalls this class loader from the SPL autoloader stack.
*/ */
@ -147,7 +147,7 @@ class Autoloader
{ {
spl_autoload_unregister(array($this, 'loadClass')); spl_autoload_unregister(array($this, 'loadClass'));
} }
/** /**
* Loads the given class or interface. * Loads the given class or interface.
* *

View File

@ -26,7 +26,7 @@
*/ */
namespace PHPExcel; namespace PHPExcel;
/** PHPOffice root directory */ /** PHPOffice root directory */
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__)); define('PHPEXCEL_ROOT', dirname(__FILE__));

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\CachedObjectStorage_APC * PHPExcel\CachedObjectStorage_APC
* *

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\CachedObjectStorage_ICache * PHPExcel\CachedObjectStorage_ICache
* *

View File

@ -28,7 +28,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\CachedObjectStorageFactory * PHPExcel\CachedObjectStorageFactory
* *

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\CalcEngine_CyclicReferenceStack * PHPExcel\CalcEngine_CyclicReferenceStack
* *

View File

@ -26,7 +26,7 @@
*/ */
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\CalcEngine_Logger * PHPExcel\CalcEngine_Logger
* *
@ -69,7 +69,7 @@ class CalcEngine_Logger {
*/ */
private $_cellStack; private $_cellStack;
/** /**
* Instantiate a Calculation engine logger * Instantiate a Calculation engine logger
* *
@ -124,13 +124,13 @@ class CalcEngine_Logger {
$message = implode(func_get_args()); $message = implode(func_get_args());
$cellReference = implode(' -> ', $this->_cellStack->showStack()); $cellReference = implode(' -> ', $this->_cellStack->showStack());
if ($this->_echoDebugLog) { if ($this->_echoDebugLog) {
echo $cellReference, echo $cellReference,
($this->_cellStack->count() > 0 ? ' => ' : ''), ($this->_cellStack->count() > 0 ? ' => ' : ''),
$message, $message,
PHP_EOL; PHP_EOL;
} }
$this->_debugLog[] = $cellReference . $this->_debugLog[] = $cellReference .
($this->_cellStack->count() > 0 ? ' => ' : '') . ($this->_cellStack->count() > 0 ? ' => ' : '') .
$message; $message;
} }
} }

View File

@ -1309,10 +1309,10 @@ class Calculation_Financial {
/** /**
* IRR * IRR
* *
* Returns the internal rate of return for a series of cash flows represented by the numbers in values. * 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 * 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 * 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. * periods.
* *
* Excel Function: * 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 * @param float[] $values An array or a reference to cells that contain numbers for which you want
* to calculate the internal rate of return. * 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. * calculate the internal rate of return.
* @param float $guess A number that you guess is close to the result of IRR * @param float $guess A number that you guess is close to the result of IRR
* @return float * @return float
@ -1358,9 +1358,9 @@ class Calculation_Financial {
$dx *= 0.5; $dx *= 0.5;
$x_mid = $rtb + $dx; $x_mid = $rtb + $dx;
$f_mid = self::NPV($x_mid, $values); $f_mid = self::NPV($x_mid, $values);
if ($f_mid <= 0.0) if ($f_mid <= 0.0)
$rtb = $x_mid; $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 $x_mid;
} }
return Calculation_Functions::VALUE(); return Calculation_Functions::VALUE();
@ -1411,7 +1411,7 @@ class Calculation_Financial {
/** /**
* MIRR * 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. * the cost of the investment and the interest received on reinvestment of cash.
* *
* Excel Function: * Excel Function:

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\Calculation_Function * PHPExcel\Calculation_Function
* *

View File

@ -482,7 +482,7 @@ class Calculation_TextData {
* @param string $oldText String to modify * @param string $oldText String to modify
* @param int $start Start character * @param int $start Start character
* @param int $chars Number of characters * @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 * @return string
*/ */
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) { public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\Cell * PHPExcel\Cell
* *

View File

@ -25,7 +25,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\IComparable * PHPExcel\IComparable
* *

View File

@ -88,7 +88,7 @@ class Reader_Excel2003XML extends Reader_Abstract implements Reader_IReader
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
// Read sample data (first 2 KB will do) // Read sample data (first 2 KB will do)
$data = fread($fileHandle, 2048); $data = fread($fileHandle, 2048);
fclose($fileHandle); fclose($fileHandle);

View File

@ -25,7 +25,7 @@
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
namespace PHPExcel; namespace PHPExcel;
defined('IDENTIFIER_OLE') || defined('IDENTIFIER_OLE') ||

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\Shared_String * PHPExcel\Shared_String
* *

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
if (!defined('DATE_W3C')) { if (!defined('DATE_W3C')) {
define('DATE_W3C', 'Y-m-d\TH:i:sP'); define('DATE_W3C', 'Y-m-d\TH:i:sP');
} }

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
if (!defined('PCLZIP_TEMPORARY_DIR')) { if (!defined('PCLZIP_TEMPORARY_DIR')) {
define('PCLZIP_TEMPORARY_DIR', Shared_File::sys_get_temp_dir()); define('PCLZIP_TEMPORARY_DIR', Shared_File::sys_get_temp_dir());
} }

View File

@ -26,7 +26,7 @@
*/ */
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel * PHPExcel
* *

View File

@ -27,7 +27,7 @@
namespace PHPExcel; namespace PHPExcel;
/** /**
* PHPExcel\Worksheet * PHPExcel\Worksheet
* *
@ -1165,8 +1165,8 @@ class Worksheet implements IComparable
$cell = $this->_cellCollection->addCacheData( $cell = $this->_cellCollection->addCacheData(
$pCoordinate, $pCoordinate,
new Cell( new Cell(
null, null,
Cell_DataType::TYPE_NULL, Cell_DataType::TYPE_NULL,
$this $this
) )
); );
@ -1193,7 +1193,7 @@ class Worksheet implements IComparable
return $cell; return $cell;
} }
/** /**
* Does the cell at a specific coordinate exist? * Does the cell at a specific coordinate exist?
* *

View File

@ -130,7 +130,7 @@ class Writer_Excel2007_Theme extends Writer_Excel2007_WriterPart
'hlink' => '0000FF', 'hlink' => '0000FF',
'folHlink' => '800080', 'folHlink' => '800080',
); );
/** /**
* Write theme to XML format * Write theme to XML format
* *
@ -868,6 +868,6 @@ class Writer_Excel2007_Theme extends Writer_Excel2007_WriterPart
$objWriter->endElement(); $objWriter->endElement();
} }
} }
} }

View File

@ -60,7 +60,7 @@ class Writer_Excel5_Escher
* @var array * @var array
*/ */
private $_spTypes; private $_spTypes;
/** /**
* Constructor * Constructor
* *
@ -317,7 +317,7 @@ class Writer_Excel5_Escher
// get the shape offsets relative to the spgrContainer record // get the shape offsets relative to the spgrContainer record
$spOffsets = $writer->getSpOffsets(); $spOffsets = $writer->getSpOffsets();
$spTypes = $writer->getSpTypes(); $spTypes = $writer->getSpTypes();
// save the shape offsets relative to dgContainer // save the shape offsets relative to dgContainer
foreach ($spOffsets as & $spOffset) { foreach ($spOffsets as & $spOffset) {
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes) $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) // save the shape offsets (where new shape records begin)
$totalSize += strlen($spData); $totalSize += strlen($spData);
$spOffsets[] = $totalSize; $spOffsets[] = $totalSize;
$spTypes = array_merge($spTypes, $writer->getSpTypes()); $spTypes = array_merge($spTypes, $writer->getSpTypes());
} }
@ -469,7 +469,7 @@ class Writer_Excel5_Escher
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
$c1, $startOffsetX, $r1, $startOffsetY, $c1, $startOffsetX, $r1, $startOffsetY,
$c2, $endOffsetX, $r2, $endOffsetY); $c2, $endOffsetX, $r2, $endOffsetY);
$length = strlen($clientAnchorData); $length = strlen($clientAnchorData);
$recVerInstance = $recVer; $recVerInstance = $recVer;
@ -534,6 +534,6 @@ class Writer_Excel5_Escher
{ {
return $this->_spTypes; return $this->_spTypes;
} }
} }

View File

@ -966,9 +966,9 @@ class Writer_HTML extends Writer_Abstract implements Writer_IWriter {
private function _createCSSStyleBorder(Style_Border $pStyle) { private function _createCSSStyleBorder(Style_Border $pStyle) {
// Create CSS // Create CSS
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); // $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
// Create CSS - add !important to non-none border styles for merged cells // Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
// Return // Return
return $css; return $css;
@ -1019,7 +1019,7 @@ class Writer_HTML extends Writer_Abstract implements Writer_IWriter {
// Construct HTML // Construct HTML
$html = ''; $html = '';
$html .= $this->_setMargins($pSheet); $html .= $this->_setMargins($pSheet);
if (!$this->_useInlineCss) { if (!$this->_useInlineCss) {
$gridlines = $pSheet->getShowGridLines() ? ' gridlines' : ''; $gridlines = $pSheet->getShowGridLines() ? ' gridlines' : '';
$html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL; $html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL;

View File

@ -43,7 +43,7 @@ class Writer_PDF
* *
* @var PHPExcel\Writer_PDF_Core * @var PHPExcel\Writer_PDF_Core
*/ */
private $_renderer = null; private $renderer = null;
/** /**
* Instantiate a new renderer of the configured type within this container class * Instantiate a new renderer of the configured type within this container class
@ -69,7 +69,7 @@ class Writer_PDF
} }
$rendererName = __NAMESPACE__ . '\Writer_PDF_' . $pdfLibraryName; $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) public function __call($name, $arguments)
{ {
if ($this->_renderer === null) { if ($this->renderer === null) {
throw new Writer_Exception("PDF Rendering library has not been defined."); 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);
} }
} }