From ffdb1966b119d6378827959999812f1df9e67b08 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 19 Mar 2012 00:25:29 +0000 Subject: [PATCH] Doc Block changes git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@88003 2327b42d-5241-43d6-9e2a-de5ac946f064 --- .../Shared/OLE/ChainedBlockStream.php | 27 ++++---- Classes/PHPExcel/Shared/ZipArchive.php | 16 +++++ Classes/PHPExcel/Shared/ZipStreamWrapper.php | 28 ++++++-- .../PHPExcel/Shared/trend/bestFitClass.php | 65 ++++++++++++------- .../Shared/trend/exponentialBestFitClass.php | 34 ++++++++-- .../Shared/trend/linearBestFitClass.php | 30 +++++++-- .../Shared/trend/logarithmicBestFitClass.php | 30 +++++++-- .../Shared/trend/polynomialBestFitClass.php | 45 +++++++++++-- .../Shared/trend/powerBestFitClass.php | 32 +++++++-- Classes/PHPExcel/Shared/trend/trendClass.php | 54 +++++++++++---- Classes/PHPExcel/Style/NumberFormat.php | 15 +++++ 11 files changed, 296 insertions(+), 80 deletions(-) diff --git a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php index 2955a1ab..77b8ff8a 100644 --- a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php +++ b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php @@ -64,12 +64,13 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Implements support for fopen(). * For creating streams using this wrapper, use OLE_PPS_File::getStream(). - * @param string resource name including scheme, e.g. - * ole-chainedblockstream://oleInstanceId=1 - * @param string only "r" is supported - * @param int mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH - * @param string absolute path of the opened stream (out parameter) - * @return bool true on success + * + * @param string $path resource name including scheme, e.g. + * ole-chainedblockstream://oleInstanceId=1 + * @param string $mode only "r" is supported + * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH + * @param string &$openedPath absolute path of the opened stream (out parameter) + * @return bool true on success */ public function stream_open($path, $mode, $options, &$openedPath) { @@ -129,7 +130,7 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Implements support for fclose(). - * @return string + * */ public function stream_close() { @@ -139,7 +140,8 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Implements support for fread(), fgets() etc. - * @param int maximum number of bytes to read + * + * @param int $count maximum number of bytes to read * @return string */ public function stream_read($count) @@ -154,6 +156,7 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Implements support for feof(). + * * @return bool TRUE if the file pointer is at EOF; otherwise FALSE */ public function stream_eof() @@ -171,6 +174,7 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Returns the position of the file pointer, i.e. its offset into the file * stream. Implements support for ftell(). + * * @return int */ public function stream_tell() @@ -180,9 +184,10 @@ class PHPExcel_Shared_OLE_ChainedBlockStream /** * Implements support for fseek(). - * @param int byte offset - * @param int SEEK_SET, SEEK_CUR or SEEK_END - * @return bool + * + * @param int $offset byte offset + * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END + * @return bool */ public function stream_seek($offset, $whence) { diff --git a/Classes/PHPExcel/Shared/ZipArchive.php b/Classes/PHPExcel/Shared/ZipArchive.php index d970191b..572b741c 100644 --- a/Classes/PHPExcel/Shared/ZipArchive.php +++ b/Classes/PHPExcel/Shared/ZipArchive.php @@ -58,6 +58,12 @@ class PHPExcel_Shared_ZipArchive private $_zip; + /** + * Open a new zip archive + * + * @param string $fileName Filename for the zip archive + * @return boolean + */ public function open($fileName) { $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); @@ -68,11 +74,21 @@ class PHPExcel_Shared_ZipArchive } + /** + * Close this zip archive + * + */ public function close() { } + /** + * Add a new file to the zip archive from a string of raw data. + * + * @param string $localname Directory/Name of the file to add to the zip archive + * @param string $contents String of data to add to the zip archive + */ public function addFromString($localname, $contents) { $filenameParts = pathinfo($localname); diff --git a/Classes/PHPExcel/Shared/ZipStreamWrapper.php b/Classes/PHPExcel/Shared/ZipStreamWrapper.php index 7a8d761a..dee93335 100644 --- a/Classes/PHPExcel/Shared/ZipStreamWrapper.php +++ b/Classes/PHPExcel/Shared/ZipStreamWrapper.php @@ -71,7 +71,13 @@ class PHPExcel_Shared_ZipStreamWrapper { } /** - * Open stream + * Implements support for fopen(). + * + * @param string $path resource name including scheme, e.g. + * @param string $mode only "r" is supported + * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH + * @param string &$openedPath absolute path of the opened stream (out parameter) + * @return bool true on success */ public function stream_open($path, $mode, $options, &$opened_path) { // Check for mode @@ -95,14 +101,19 @@ class PHPExcel_Shared_ZipStreamWrapper { } /** - * Stat stream + * Implements support for fstat(). + * + * @return boolean */ public function stream_stat() { return $this->_archive->statName( $this->_fileNameInArchive ); } /** - * Read stream + * Implements support for fread(), fgets() etc. + * + * @param int $count maximum number of bytes to read + * @return string */ function stream_read($count) { $ret = substr($this->_data, $this->_position, $count); @@ -111,7 +122,10 @@ class PHPExcel_Shared_ZipStreamWrapper { } /** - * Tell stream + * Returns the position of the file pointer, i.e. its offset into the file + * stream. Implements support for ftell(). + * + * @return int */ public function stream_tell() { return $this->_position; @@ -119,6 +133,8 @@ class PHPExcel_Shared_ZipStreamWrapper { /** * EOF stream + * + * @return bool */ public function stream_eof() { return $this->_position >= strlen($this->_data); @@ -126,6 +142,10 @@ class PHPExcel_Shared_ZipStreamWrapper { /** * Seek stream + * + * @param int $offset byte offset + * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END + * @return bool */ public function stream_seek($offset, $whence) { switch ($whence) { diff --git a/Classes/PHPExcel/Shared/trend/bestFitClass.php b/Classes/PHPExcel/Shared/trend/bestFitClass.php index 810177ad..fa7ecbed 100644 --- a/Classes/PHPExcel/Shared/trend/bestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/bestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -30,65 +30,58 @@ * PHPExcel_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Best_Fit { - /* + /** * Indicator flag for a calculation error * - * @protected * @var boolean - */ + **/ protected $_error = False; - /* + /** * Algorithm type to use for best-fit * - * @protected * @var string - */ + **/ protected $_bestFitType = 'undetermined'; - /* + /** * Number of entries in the sets of x- and y-value arrays * - * @protected * @var int - */ + **/ protected $_valueCount = 0; - /* + /** * X-value dataseries of values * - * @protected * @var float[] - */ + **/ protected $_xValues = array(); - /* + /** * Y-value dataseries of values * - * @protected * @var float[] - */ + **/ protected $_yValues = array(); - /* - * X-value series of values + /** + * Flag indicating whether values should be adjusted to Y=0 * - * @protected * @var boolean - */ + **/ protected $_adjustToZero = False; - /* + /** * Y-value series of best-fit values * - * @protected * @var float[] - */ + **/ protected $_yBestFitValues = array(); protected $_goodnessOfFit = 1; @@ -152,6 +145,11 @@ class PHPExcel_Best_Fit } // function getValueOfXForY() + /** + * Return the original set of X-Values + * + * @return float[] X-Values + */ public function getXValues() { return $this->_xValues; } // function getValueOfXForY() @@ -224,6 +222,12 @@ class PHPExcel_Best_Fit } // function getIntersectSE() + /** + * Return the goodness of fit for this regression + * + * @param int $dp Number of places of decimal precision to return + * @return float + */ public function getGoodnessOfFit($dp=0) { if ($dp != 0) { return round($this->_goodnessOfFit,$dp); @@ -240,6 +244,12 @@ class PHPExcel_Best_Fit } // function getGoodnessOfFitPercent() + /** + * Return the standard deviation of the residuals for this regression + * + * @param int $dp Number of places of decimal precision to return + * @return float + */ public function getStdevOfResiduals($dp=0) { if ($dp != 0) { return round($this->_stdevOfResiduals,$dp); @@ -392,6 +402,13 @@ class PHPExcel_Best_Fit } // function _leastSquareFit() + /** + * Define the regression + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($yValues, $xValues=array(), $const=True) { // Calculate number of points $nY = count($yValues); diff --git a/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php b/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php index aaedf6c5..37f3c339 100644 --- a/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -33,11 +33,17 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * PHPExcel_Exponential_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit { + /** + * Algorithm type to use for best-fit + * (Name of this trend class) + * + * @var string + **/ protected $_bestFitType = 'exponential'; @@ -46,7 +52,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit * * @param float $xValue X-Value * @return float Y-Value - */ + **/ public function getValueOfYForX($xValue) { return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset)); } // function getValueOfYForX() @@ -57,7 +63,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit * * @param float $yValue Y-Value * @return float X-Value - */ + **/ public function getValueOfXForY($yValue) { return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope()); } // function getValueOfXForY() @@ -68,7 +74,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); @@ -82,7 +88,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getSlope($dp=0) { if ($dp != 0) { return round(exp($this->_slope),$dp); @@ -96,7 +102,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getIntersect($dp=0) { if ($dp != 0) { return round(exp($this->_intersect),$dp); @@ -105,6 +111,13 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit } // function getIntersect() + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ private function _exponential_regression($yValues, $xValues, $const) { foreach($yValues as &$value) { if ($value < 0.0) { @@ -119,6 +132,13 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit } // function _exponential_regression() + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { $this->_exponential_regression($yValues, $xValues, $const); diff --git a/Classes/PHPExcel/Shared/trend/linearBestFitClass.php b/Classes/PHPExcel/Shared/trend/linearBestFitClass.php index 6b160870..f9d99039 100644 --- a/Classes/PHPExcel/Shared/trend/linearBestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/linearBestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -33,11 +33,17 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * PHPExcel_Linear_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit { + /** + * Algorithm type to use for best-fit + * (Name of this trend class) + * + * @var string + **/ protected $_bestFitType = 'linear'; @@ -46,7 +52,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit * * @param float $xValue X-Value * @return float Y-Value - */ + **/ public function getValueOfYForX($xValue) { return $this->getIntersect() + $this->getSlope() * $xValue; } // function getValueOfYForX() @@ -57,7 +63,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit * * @param float $yValue Y-Value * @return float X-Value - */ + **/ public function getValueOfXForY($yValue) { return ($yValue - $this->getIntersect()) / $this->getSlope(); } // function getValueOfXForY() @@ -68,7 +74,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); @@ -77,11 +83,25 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit } // function getEquation() + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ private function _linear_regression($yValues, $xValues, $const) { $this->_leastSquareFit($yValues, $xValues,$const); } // function _linear_regression() + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { $this->_linear_regression($yValues, $xValues, $const); diff --git a/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php b/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php index 3ddbd4ee..4121cfb9 100644 --- a/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -33,11 +33,17 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * PHPExcel_Logarithmic_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit { + /** + * Algorithm type to use for best-fit + * (Name of this trend class) + * + * @var string + **/ protected $_bestFitType = 'logarithmic'; @@ -46,7 +52,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit * * @param float $xValue X-Value * @return float Y-Value - */ + **/ public function getValueOfYForX($xValue) { return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset); } // function getValueOfYForX() @@ -57,7 +63,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit * * @param float $yValue Y-Value * @return float X-Value - */ + **/ public function getValueOfXForY($yValue) { return exp(($yValue - $this->getIntersect()) / $this->getSlope()); } // function getValueOfXForY() @@ -68,7 +74,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); @@ -77,6 +83,13 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit } // function getEquation() + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ private function _logarithmic_regression($yValues, $xValues, $const) { foreach($xValues as &$value) { if ($value < 0.0) { @@ -91,6 +104,13 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit } // function _logarithmic_regression() + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { $this->_logarithmic_regression($yValues, $xValues, $const); diff --git a/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php b/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php index b475ef5b..21c5d582 100644 --- a/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -34,16 +34,33 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php'; * PHPExcel_Polynomial_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit { + /** + * Algorithm type to use for best-fit + * (Name of this trend class) + * + * @var string + **/ protected $_bestFitType = 'polynomial'; + /** + * Polynomial order + * + * @protected + * @var int + **/ protected $_order = 0; + /** + * Return the order of this polynomial + * + * @return int + **/ public function getOrder() { return $this->_order; } // function getOrder() @@ -54,7 +71,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit * * @param float $xValue X-Value * @return float Y-Value - */ + **/ public function getValueOfYForX($xValue) { $retVal = $this->getIntersect(); $slope = $this->getSlope(); @@ -72,7 +89,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit * * @param float $yValue Y-Value * @return float X-Value - */ + **/ public function getValueOfXForY($yValue) { return ($yValue - $this->getIntersect()) / $this->getSlope(); } // function getValueOfXForY() @@ -83,7 +100,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); @@ -106,7 +123,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getSlope($dp=0) { if ($dp != 0) { $coefficients = array(); @@ -124,6 +141,14 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit } // function getCoefficients() + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param int $order Order of Polynomial for this regression + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ private function _polynomial_regression($order, $yValues, $xValues, $const) { // calculate sums $x_sum = array_sum($xValues); @@ -173,6 +198,14 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit } // function _polynomial_regression() + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param int $order Order of Polynomial for this regression + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($order, $yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { if ($order < $this->_valueCount) { diff --git a/Classes/PHPExcel/Shared/trend/powerBestFitClass.php b/Classes/PHPExcel/Shared/trend/powerBestFitClass.php index c0029317..d9525a23 100644 --- a/Classes/PHPExcel/Shared/trend/powerBestFitClass.php +++ b/Classes/PHPExcel/Shared/trend/powerBestFitClass.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -33,11 +33,17 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'; * PHPExcel_Power_Best_Fit * * @category PHPExcel - * @package PHPExcel_Shared_Best_Fit + * @package PHPExcel_Shared_Trend * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit { + /** + * Algorithm type to use for best-fit + * (Name of this trend class) + * + * @var string + **/ protected $_bestFitType = 'power'; @@ -46,7 +52,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit * * @param float $xValue X-Value * @return float Y-Value - */ + **/ public function getValueOfYForX($xValue) { return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope()); } // function getValueOfYForX() @@ -57,7 +63,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit * * @param float $yValue Y-Value * @return float X-Value - */ + **/ public function getValueOfXForY($yValue) { return pow((($yValue + $this->_Yoffset) / $this->getIntersect()),(1 / $this->getSlope())); } // function getValueOfXForY() @@ -68,7 +74,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); @@ -82,7 +88,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit * * @param int $dp Number of places of decimal precision to display * @return string - */ + **/ public function getIntersect($dp=0) { if ($dp != 0) { return round(exp($this->_intersect),$dp); @@ -91,6 +97,13 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit } // function getIntersect() + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ private function _power_regression($yValues, $xValues, $const) { foreach($xValues as &$value) { if ($value < 0.0) { @@ -113,6 +126,13 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit } // function _power_regression() + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param boolean $const + */ function __construct($yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { $this->_power_regression($yValues, $xValues, $const); diff --git a/Classes/PHPExcel/Shared/trend/trendClass.php b/Classes/PHPExcel/Shared/trend/trendClass.php index 9ea1a88b..6c68beaf 100644 --- a/Classes/PHPExcel/Shared/trend/trendClass.php +++ b/Classes/PHPExcel/Shared/trend/trendClass.php @@ -1,4 +1,30 @@ '', @@ -483,10 +488,20 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable // fractional seconds - no php equivalent '.s' => '' ); + /** + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock) + * + * @var array + */ private static $_dateFormatReplacements24 = array( 'hh' => 'H', 'h' => 'G' ); + /** + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock) + * + * @var array + */ private static $_dateFormatReplacements12 = array( 'hh' => 'h', 'h' => 'g'