Doc Block changes

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@88003 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-03-19 00:25:29 +00:00
parent 8ade1b8a69
commit ffdb1966b1
11 changed files with 296 additions and 80 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -1,4 +1,30 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2012 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @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##
*/
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/linearBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/logarithmicBestFitClass.php';
@ -7,6 +33,13 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/powerBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php';
/**
* PHPExcel_trendClass
*
* @category PHPExcel
* @package PHPExcel_Shared_Trend
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class trendClass
{
const TREND_LINEAR = 'Linear';
@ -21,23 +54,21 @@ class trendClass
const TREND_BEST_FIT = 'Bestfit';
const TREND_BEST_FIT_NO_POLY = 'Bestfit_no_Polynomials';
/*
/**
* Names of the best-fit trend analysis methods
*
* @private
* @var string[]
*/
* @var string[]
**/
private static $_trendTypes = array( self::TREND_LINEAR,
self::TREND_LOGARITHMIC,
self::TREND_EXPONENTIAL,
self::TREND_POWER
);
/*
/**
* Names of the best-fit trend polynomial orders
*
* @private
* @var string[]
*/
* @var string[]
**/
private static $_trendTypePolyOrders = array( self::TREND_POLYNOMIAL_2,
self::TREND_POLYNOMIAL_3,
self::TREND_POLYNOMIAL_4,
@ -45,12 +76,11 @@ class trendClass
self::TREND_POLYNOMIAL_6
);
/*
/**
* Cached results for each method when trying to identify which provides the best fit
*
* @private
* @var PHPExcel_Shared_Best_Fit[]
*/
* @var PHPExcel_Best_Fit[]
**/
private static $_trendCache = array();

View File

@ -449,6 +449,11 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
}
}
/**
* Search/replace values to convert Excel date/time format masks to PHP format masks
*
* @var array
*/
private static $_dateFormatReplacements = array(
// first remove escapes related to non-format characters
'\\' => '',
@ -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'