From 28f266bbba10f08899d40cd23058ccae4ab940a5 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sat, 27 Apr 2013 16:02:07 +0100 Subject: [PATCH] Docblock comments --- .../CalcEngine/CyclicReferenceStack.php | 42 ++++++++++++- Classes/PHPExcel/CalcEngine/Logger.php | 40 +++++++++++-- Classes/PHPExcel/Calculation/Token/Stack.php | 60 +++++++++++++++---- Classes/PHPExcel/Cell.php | 3 +- Classes/PHPExcel/Comment.php | 5 ++ Classes/PHPExcel/RichText.php | 2 +- 6 files changed, 135 insertions(+), 17 deletions(-) diff --git a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php index e64b468..c35a119 100644 --- a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php +++ b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php @@ -26,31 +26,71 @@ */ +/** + * PHPExcel_CalcEngine_CyclicReferenceStack + * + * @category PHPExcel_CalcEngine_CyclicReferenceStack + * @package PHPExcel_Calculation + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + */ class PHPExcel_CalcEngine_CyclicReferenceStack { + /** + * The call stack for calculated cells + * + * @var mixed[] + */ private $_stack = array(); + /** + * Return the number of entries on the stack + * + * @return integer + */ public function count() { return count($this->_stack); } + /** + * Push a new entry onto the stack + * + * @param mixed $value + */ public function push($value) { $this->_stack[] = $value; } // function push() + /** + * Pop the last entry from the stack + * + * @return mixed + */ public function pop() { return array_pop($this->_stack); } // function pop() + /** + * Test to see if a specified entry exists on the stack + * + * @param mixed $value The value to test + */ public function onStack($value) { - return in_array($value,$this->_stack); + return in_array($value, $this->_stack); } + /** + * Clear the stack + */ public function clear() { $this->_stack = array(); } // function push() + /** + * Return an array of all entries on the stack + * + * @return mixed[] + */ public function showStack() { return $this->_stack; } diff --git a/Classes/PHPExcel/CalcEngine/Logger.php b/Classes/PHPExcel/CalcEngine/Logger.php index 250f841..a34a568 100644 --- a/Classes/PHPExcel/CalcEngine/Logger.php +++ b/Classes/PHPExcel/CalcEngine/Logger.php @@ -40,7 +40,6 @@ class PHPExcel_CalcEngine_Logger { * If false, then a debug log will not be generated * * @var boolean - * */ private $_writeDebugLog = FALSE; @@ -51,7 +50,6 @@ class PHPExcel_CalcEngine_Logger { * A debug log can only be echoed if it is generated * * @var boolean - * */ private $_echoDebugLog = FALSE; @@ -59,7 +57,6 @@ class PHPExcel_CalcEngine_Logger { * The debug log generated by the calculation engine * * @var string[] - * */ private $_debugLog = array(); @@ -67,31 +64,58 @@ class PHPExcel_CalcEngine_Logger { * The calculation engine cell reference stack * * @var PHPExcel_CalcEngine_CyclicReferenceStack - * */ private $_cellStack; + /** + * Instantiate a Calculation engine logger + * + * @param PHPExcel_CalcEngine_CyclicReferenceStack $stack + */ public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) { $this->_cellStack = $stack; } + /** + * Enable/Disable Calculation engine logging + * + * @param boolean $pValue + */ public function setWriteDebugLog($pValue = FALSE) { $this->_writeDebugLog = $pValue; } + /** + * Return whether calculation engine logging is enabled or disabled + * + * @return boolean + */ public function getWriteDebugLog() { return $this->_writeDebugLog; } + /** + * Enable/Disable echoing of debug log information + * + * @param boolean $pValue + */ public function setEchoDebugLog($pValue = FALSE) { $this->_echoDebugLog = $pValue; } + /** + * Return whether echoing of debug log information is enabled or disabled + * + * @return boolean + */ public function getEchoDebugLog() { return $this->_echoDebugLog; } + /** + * Write an entry to the calculation engine debug log + */ public function writeDebugLog() { // Only write the debug log if logging is enabled if ($this->_writeDebugLog) { @@ -109,10 +133,18 @@ class PHPExcel_CalcEngine_Logger { } } // function _writeDebug() + /** + * Clear the calculation engine debug log + */ public function clearLog() { $this->_debugLog = array(); } // function flushLogger() + /** + * Return the calculation engine debug log + * + * @return string[] + */ public function getLog() { return $this->_debugLog; } // function flushLogger() diff --git a/Classes/PHPExcel/Calculation/Token/Stack.php b/Classes/PHPExcel/Calculation/Token/Stack.php index bdf9d55..3a94fa2 100644 --- a/Classes/PHPExcel/Calculation/Token/Stack.php +++ b/Classes/PHPExcel/Calculation/Token/Stack.php @@ -26,18 +26,47 @@ */ +/** + * PHPExcel_Calculation_Token_Stack + * + * @category PHPExcel_Calculation_Token_Stack + * @package PHPExcel_Calculation + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + */ class PHPExcel_Calculation_Token_Stack { + /** + * The parser stack for formulae + * + * @var mixed[] + */ private $_stack = array(); + + /** + * Count of entries in the parser stack + * + * @var integer + */ private $_count = 0; + /** + * Return the number of entries on the stack + * + * @return integer + */ public function count() { return $this->_count; } // function count() - - public function push($type,$value,$reference=null) { + /** + * Push a new entry onto the stack + * + * @param mixed $type + * @param mixed $value + * @param mixed $reference + */ + public function push($type, $value, $reference = NULL) { $this->_stack[$this->_count++] = array('type' => $type, 'value' => $value, 'reference' => $reference @@ -50,23 +79,34 @@ class PHPExcel_Calculation_Token_Stack { } } // function push() - + /** + * Pop the last entry from the stack + * + * @return mixed + */ public function pop() { if ($this->_count > 0) { return $this->_stack[--$this->_count]; } - return null; + return NULL; } // function pop() - - public function last($n=1) { - if ($this->_count-$n < 0) { - return null; + /** + * Return an entry from the stack without removing it + * + * @param integer $n number indicating how far back in the stack we want to look + * @return mixed + */ + public function last($n = 1) { + if ($this->_count - $n < 0) { + return NULL; } - return $this->_stack[$this->_count-$n]; + return $this->_stack[$this->_count - $n]; } // function last() - + /** + * Clear the stack + */ function clear() { $this->_stack = array(); $this->_count = 0; diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 27fb914..310680c 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -268,6 +268,7 @@ class PHPExcel_Cell * * @deprecated Since version 1.7.8 for planned changes to cell for array formula handling * + * @param boolean $resetLog Whether the calculation engine logger should be reset or not * @return mixed * @throws PHPExcel_Exception */ @@ -858,7 +859,7 @@ class PHPExcel_Cell * Compare 2 cells * * @param PHPExcel_Cell $a Cell a - * @param PHPExcel_Cell $a Cell b + * @param PHPExcel_Cell $b Cell b * @return int Result of comparison (always -1 or 1, never zero!) */ public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) diff --git a/Classes/PHPExcel/Comment.php b/Classes/PHPExcel/Comment.php index e9f2578..af40420 100644 --- a/Classes/PHPExcel/Comment.php +++ b/Classes/PHPExcel/Comment.php @@ -315,6 +315,11 @@ class PHPExcel_Comment implements PHPExcel_IComparable } } + /** + * Convert to string + * + * @return string + */ public function __toString() { return $this->_text->getPlainText(); } diff --git a/Classes/PHPExcel/RichText.php b/Classes/PHPExcel/RichText.php index 0900490..848098f 100644 --- a/Classes/PHPExcel/RichText.php +++ b/Classes/PHPExcel/RichText.php @@ -45,7 +45,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable /** * Create a new PHPExcel_RichText instance * - * @param PHPExcel_Cell $pParent + * @param PHPExcel_Cell $pCell * @throws PHPExcel_Exception */ public function __construct(PHPExcel_Cell $pCell = null)