PSR2 Fixes
This commit is contained in:
parent
1bf5ea414b
commit
f827a25af2
File diff suppressed because it is too large
Load Diff
|
@ -45,7 +45,8 @@ class PHPExcel_Shared_PasswordHasher
|
||||||
* @param string $pPassword Password to hash
|
* @param string $pPassword Password to hash
|
||||||
* @return string Hashed password
|
* @return string Hashed password
|
||||||
*/
|
*/
|
||||||
public static function hashPassword($pPassword = '') {
|
public static function hashPassword($pPassword = '')
|
||||||
|
{
|
||||||
$password = 0x0000;
|
$password = 0x0000;
|
||||||
$charPos = 1; // char position
|
$charPos = 1; // char position
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,8 @@ class PHPExcel_Shared_String
|
||||||
/**
|
/**
|
||||||
* Build control characters array
|
* Build control characters array
|
||||||
*/
|
*/
|
||||||
private static function _buildControlCharacters() {
|
private static function _buildControlCharacters()
|
||||||
|
{
|
||||||
for ($i = 0; $i <= 31; ++$i) {
|
for ($i = 0; $i <= 31; ++$i) {
|
||||||
if ($i != 9 && $i != 10 && $i != 13) {
|
if ($i != 9 && $i != 10 && $i != 13) {
|
||||||
$find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
|
$find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
|
||||||
|
@ -316,10 +317,7 @@ class PHPExcel_Shared_String
|
||||||
}
|
}
|
||||||
|
|
||||||
// CUSTOM: IBM AIX iconv() does not work
|
// CUSTOM: IBM AIX iconv() does not work
|
||||||
if ( defined('PHP_OS') && @stristr(PHP_OS, 'AIX')
|
if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
|
||||||
&& defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
|
|
||||||
&& defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0) )
|
|
||||||
{
|
|
||||||
self::$_isIconvEnabled = false;
|
self::$_isIconvEnabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +327,8 @@ class PHPExcel_Shared_String
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function buildCharacterSets() {
|
public static function buildCharacterSets()
|
||||||
|
{
|
||||||
if (empty(self::$_controlCharacters)) {
|
if (empty(self::$_controlCharacters)) {
|
||||||
self::_buildControlCharacters();
|
self::_buildControlCharacters();
|
||||||
}
|
}
|
||||||
|
@ -352,7 +351,8 @@ class PHPExcel_Shared_String
|
||||||
* @param string $value Value to unescape
|
* @param string $value Value to unescape
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function ControlCharacterOOXML2PHP($value = '') {
|
public static function ControlCharacterOOXML2PHP($value = '')
|
||||||
|
{
|
||||||
return str_replace(array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value);
|
return str_replace(array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,8 @@ class PHPExcel_Shared_String
|
||||||
* @param string $value Value to escape
|
* @param string $value Value to escape
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function ControlCharacterPHP2OOXML($value = '') {
|
public static function ControlCharacterPHP2OOXML($value = '')
|
||||||
|
{
|
||||||
return str_replace(array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value);
|
return str_replace(array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +403,8 @@ class PHPExcel_Shared_String
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function IsUTF8($value = '') {
|
public static function IsUTF8($value = '')
|
||||||
|
{
|
||||||
return $value === '' || preg_match('/^./su', $value) === 1;
|
return $value === '' || preg_match('/^./su', $value) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +415,8 @@ class PHPExcel_Shared_String
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function FormatNumber($value) {
|
public static function FormatNumber($value)
|
||||||
|
{
|
||||||
if (is_float($value)) {
|
if (is_float($value)) {
|
||||||
return str_replace(',', '.', $value);
|
return str_replace(',', '.', $value);
|
||||||
}
|
}
|
||||||
|
@ -524,16 +527,27 @@ class PHPExcel_Shared_String
|
||||||
* @author vadik56
|
* @author vadik56
|
||||||
*/
|
*/
|
||||||
public static function utf16_decode($str, $bom_be = TRUE) {
|
public static function utf16_decode($str, $bom_be = TRUE) {
|
||||||
if ( strlen($str) < 2 ) return $str;
|
if (strlen($str) < 2) {
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
$c0 = ord($str{0});
|
$c0 = ord($str{0});
|
||||||
$c1 = ord($str{1});
|
$c1 = ord($str{1});
|
||||||
if ( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
|
if ($c0 == 0xfe && $c1 == 0xff) {
|
||||||
elseif ( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
|
$str = substr($str,2);
|
||||||
|
} elseif ($c0 == 0xff && $c1 == 0xfe) {
|
||||||
|
$str = substr($str,2);
|
||||||
|
$bom_be = false;
|
||||||
|
}
|
||||||
$len = strlen($str);
|
$len = strlen($str);
|
||||||
$newstr = '';
|
$newstr = '';
|
||||||
for($i=0;$i<$len;$i+=2) {
|
for($i=0;$i<$len;$i+=2) {
|
||||||
if ( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
|
if ($bom_be) {
|
||||||
else { $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
|
$val = ord($str{$i}) << 4;
|
||||||
|
$val += ord($str{$i+1});
|
||||||
|
} else {
|
||||||
|
$val = ord($str{$i+1}) << 4;
|
||||||
|
$val += ord($str{$i});
|
||||||
|
}
|
||||||
$newstr .= ($val == 0x228) ? "\n" : chr($val);
|
$newstr .= ($val == 0x228) ? "\n" : chr($val);
|
||||||
}
|
}
|
||||||
return $newstr;
|
return $newstr;
|
||||||
|
@ -667,7 +681,8 @@ class PHPExcel_Shared_String
|
||||||
* @param string &$operand string value to test
|
* @param string &$operand string value to test
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function convertToNumberIfFraction(&$operand) {
|
public static function convertToNumberIfFraction(&$operand)
|
||||||
|
{
|
||||||
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
|
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
|
||||||
$sign = ($match[1] == '-') ? '-' : '+';
|
$sign = ($match[1] == '-') ? '-' : '+';
|
||||||
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
|
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
|
||||||
|
@ -802,8 +817,9 @@ class PHPExcel_Shared_String
|
||||||
*/
|
*/
|
||||||
public static function testStringAsNumeric($value)
|
public static function testStringAsNumeric($value)
|
||||||
{
|
{
|
||||||
if (is_numeric($value))
|
if (is_numeric($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
|
}
|
||||||
$v = floatval($value);
|
$v = floatval($value);
|
||||||
return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
|
return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ class PHPExcel_Shared_TimeZone
|
||||||
* @param string $timezone Time zone (e.g. 'Europe/London')
|
* @param string $timezone Time zone (e.g. 'Europe/London')
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function _validateTimeZone($timezone) {
|
public static function _validateTimeZone($timezone)
|
||||||
|
{
|
||||||
if (in_array($timezone, DateTimeZone::listIdentifiers())) {
|
if (in_array($timezone, DateTimeZone::listIdentifiers())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +64,8 @@ class PHPExcel_Shared_TimeZone
|
||||||
* @param string $timezone Time zone (e.g. 'Europe/London')
|
* @param string $timezone Time zone (e.g. 'Europe/London')
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setTimeZone($timezone) {
|
public static function setTimeZone($timezone)
|
||||||
|
{
|
||||||
if (self::_validateTimezone($timezone)) {
|
if (self::_validateTimezone($timezone)) {
|
||||||
self::$_timezone = $timezone;
|
self::$_timezone = $timezone;
|
||||||
return true;
|
return true;
|
||||||
|
@ -77,7 +79,8 @@ class PHPExcel_Shared_TimeZone
|
||||||
*
|
*
|
||||||
* @return string Timezone (e.g. 'Europe/London')
|
* @return string Timezone (e.g. 'Europe/London')
|
||||||
*/
|
*/
|
||||||
public static function getTimeZone() {
|
public static function getTimeZone()
|
||||||
|
{
|
||||||
return self::$_timezone;
|
return self::$_timezone;
|
||||||
} // function getTimezone()
|
} // function getTimezone()
|
||||||
|
|
||||||
|
@ -89,7 +92,8 @@ class PHPExcel_Shared_TimeZone
|
||||||
* @param integer $timestamp PHP date/time value for finding the current transition
|
* @param integer $timestamp PHP date/time value for finding the current transition
|
||||||
* @return array The current transition details
|
* @return array The current transition details
|
||||||
*/
|
*/
|
||||||
private static function _getTimezoneTransitions($objTimezone, $timestamp) {
|
private static function _getTimezoneTransitions($objTimezone, $timestamp)
|
||||||
|
{
|
||||||
$allTransitions = $objTimezone->getTransitions();
|
$allTransitions = $objTimezone->getTransitions();
|
||||||
$transitions = array();
|
$transitions = array();
|
||||||
foreach ($allTransitions as $key => $transition) {
|
foreach ($allTransitions as $key => $transition) {
|
||||||
|
@ -114,7 +118,8 @@ class PHPExcel_Shared_TimeZone
|
||||||
* @return integer Number of seconds for timezone adjustment
|
* @return integer Number of seconds for timezone adjustment
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function getTimeZoneAdjustment($timezone, $timestamp) {
|
public static function getTimeZoneAdjustment($timezone, $timestamp)
|
||||||
|
{
|
||||||
if ($timezone !== null) {
|
if ($timezone !== null) {
|
||||||
if (!self::_validateTimezone($timezone)) {
|
if (!self::_validateTimezone($timezone)) {
|
||||||
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
|
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
|
||||||
|
|
|
@ -33,7 +33,6 @@ if (!defined('DEBUGMODE_ENABLED')) {
|
||||||
define('DEBUGMODE_ENABLED', false);
|
define('DEBUGMODE_ENABLED', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_XMLWriter
|
* PHPExcel_Shared_XMLWriter
|
||||||
*
|
*
|
||||||
|
@ -41,7 +40,8 @@ if (!defined('DEBUGMODE_ENABLED')) {
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||||
|
{
|
||||||
/** Temporary storage method */
|
/** Temporary storage method */
|
||||||
const STORAGE_MEMORY = 1;
|
const STORAGE_MEMORY = 1;
|
||||||
const STORAGE_DISK = 2;
|
const STORAGE_DISK = 2;
|
||||||
|
@ -59,14 +59,15 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||||
* @param int $pTemporaryStorage Temporary storage location
|
* @param int $pTemporaryStorage Temporary storage location
|
||||||
* @param string $pTemporaryStorageFolder Temporary storage folder
|
* @param string $pTemporaryStorageFolder Temporary storage folder
|
||||||
*/
|
*/
|
||||||
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = NULL) {
|
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = null) {
|
||||||
// Open temporary storage
|
// Open temporary storage
|
||||||
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
||||||
$this->openMemory();
|
$this->openMemory();
|
||||||
} else {
|
} else {
|
||||||
// Create temporary filename
|
// Create temporary filename
|
||||||
if ($pTemporaryStorageFolder === NULL)
|
if ($pTemporaryStorageFolder === null) {
|
||||||
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
|
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
|
}
|
||||||
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||||
|
|
||||||
// Open storage
|
// Open storage
|
||||||
|
@ -85,7 +86,8 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct()
|
||||||
|
{
|
||||||
// Unlink temporary files
|
// Unlink temporary files
|
||||||
if ($this->_tempFileName != '') {
|
if ($this->_tempFileName != '') {
|
||||||
@unlink($this->_tempFileName);
|
@unlink($this->_tempFileName);
|
||||||
|
@ -97,7 +99,8 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||||
*
|
*
|
||||||
* @return $data
|
* @return $data
|
||||||
*/
|
*/
|
||||||
public function getData() {
|
public function getData()
|
||||||
|
{
|
||||||
if ($this->_tempFileName == '') {
|
if ($this->_tempFileName == '') {
|
||||||
return $this->outputMemory(true);
|
return $this->outputMemory(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -92,10 +92,7 @@ class PHPExcel_Shared_ZipArchive
|
||||||
fwrite($handle, $contents);
|
fwrite($handle, $contents);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
||||||
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
|
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
|
||||||
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
|
|
||||||
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
|
|
||||||
);
|
|
||||||
if ($res == 0) {
|
if ($res == 0) {
|
||||||
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,12 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_ZipStreamWrapper {
|
class PHPExcel_Shared_ZipStreamWrapper
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Internal ZipAcrhive
|
* Internal ZipAcrhive
|
||||||
*
|
*
|
||||||
* @var ZipAcrhive
|
* @var ZipArchive
|
||||||
*/
|
*/
|
||||||
private $_archive;
|
private $_archive;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Best_Fit
|
* PHPExcel_Best_Fit
|
||||||
*
|
*
|
||||||
|
@ -75,7 +74,7 @@ class PHPExcel_Best_Fit
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
**/
|
**/
|
||||||
protected $_adjustToZero = False;
|
protected $_adjustToZero = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y-value series of best-fit values
|
* Y-value series of best-fit values
|
||||||
|
@ -113,205 +112,207 @@ class PHPExcel_Best_Fit
|
||||||
protected $_Yoffset = 0;
|
protected $_Yoffset = 0;
|
||||||
|
|
||||||
|
|
||||||
public function getError() {
|
public function getError()
|
||||||
|
{
|
||||||
return $this->_error;
|
return $this->_error;
|
||||||
} // function getBestFitType()
|
} // function getBestFitType()
|
||||||
|
|
||||||
|
|
||||||
public function getBestFitType() {
|
public function getBestFitType()
|
||||||
|
{
|
||||||
return $this->_bestFitType;
|
return $this->_bestFitType;
|
||||||
} // function getBestFitType()
|
} // function getBestFitType()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
*/
|
*/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
return False;
|
{
|
||||||
|
return false;
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
*/
|
*/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
return False;
|
{
|
||||||
|
return false;
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the original set of X-Values
|
* Return the original set of X-Values
|
||||||
*
|
*
|
||||||
* @return float[] X-Values
|
* @return float[] X-Values
|
||||||
*/
|
*/
|
||||||
public function getXValues() {
|
public function getXValues()
|
||||||
|
{
|
||||||
return $this->_xValues;
|
return $this->_xValues;
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
return False;
|
return False;
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Slope of the line
|
* Return the Slope of the line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_slope, $dp);
|
return round($this->_slope, $dp);
|
||||||
}
|
}
|
||||||
return $this->_slope;
|
return $this->_slope;
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard error of the Slope
|
* Return the standard error of the Slope
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSlopeSE($dp=0) {
|
public function getSlopeSE($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_slopeSE, $dp);
|
return round($this->_slopeSE, $dp);
|
||||||
}
|
}
|
||||||
return $this->_slopeSE;
|
return $this->_slopeSE;
|
||||||
} // function getSlopeSE()
|
} // function getSlopeSE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Value of X where it intersects Y = 0
|
* Return the Value of X where it intersects Y = 0
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp=0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_intersect, $dp);
|
return round($this->_intersect, $dp);
|
||||||
}
|
}
|
||||||
return $this->_intersect;
|
return $this->_intersect;
|
||||||
} // function getIntersect()
|
} // function getIntersect()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard error of the Intersect
|
* Return the standard error of the Intersect
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIntersectSE($dp=0) {
|
public function getIntersectSE($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_intersectSE, $dp);
|
return round($this->_intersectSE, $dp);
|
||||||
}
|
}
|
||||||
return $this->_intersectSE;
|
return $this->_intersectSE;
|
||||||
} // function getIntersectSE()
|
} // function getIntersectSE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the goodness of fit for this regression
|
* Return the goodness of fit for this regression
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to return
|
* @param int $dp Number of places of decimal precision to return
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getGoodnessOfFit($dp=0) {
|
public function getGoodnessOfFit($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_goodnessOfFit, $dp);
|
return round($this->_goodnessOfFit, $dp);
|
||||||
}
|
}
|
||||||
return $this->_goodnessOfFit;
|
return $this->_goodnessOfFit;
|
||||||
} // function getGoodnessOfFit()
|
} // function getGoodnessOfFit()
|
||||||
|
|
||||||
|
public function getGoodnessOfFitPercent($dp = 0)
|
||||||
public function getGoodnessOfFitPercent($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_goodnessOfFit * 100, $dp);
|
return round($this->_goodnessOfFit * 100, $dp);
|
||||||
}
|
}
|
||||||
return $this->_goodnessOfFit * 100;
|
return $this->_goodnessOfFit * 100;
|
||||||
} // function getGoodnessOfFitPercent()
|
} // function getGoodnessOfFitPercent()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard deviation of the residuals for this regression
|
* Return the standard deviation of the residuals for this regression
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to return
|
* @param int $dp Number of places of decimal precision to return
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getStdevOfResiduals($dp=0) {
|
public function getStdevOfResiduals($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_stdevOfResiduals, $dp);
|
return round($this->_stdevOfResiduals, $dp);
|
||||||
}
|
}
|
||||||
return $this->_stdevOfResiduals;
|
return $this->_stdevOfResiduals;
|
||||||
} // function getStdevOfResiduals()
|
} // function getStdevOfResiduals()
|
||||||
|
|
||||||
|
public function getSSRegression($dp = 0)
|
||||||
public function getSSRegression($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_SSRegression, $dp);
|
return round($this->_SSRegression, $dp);
|
||||||
}
|
}
|
||||||
return $this->_SSRegression;
|
return $this->_SSRegression;
|
||||||
} // function getSSRegression()
|
} // function getSSRegression()
|
||||||
|
|
||||||
|
public function getSSResiduals($dp = 0)
|
||||||
public function getSSResiduals($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_SSResiduals, $dp);
|
return round($this->_SSResiduals, $dp);
|
||||||
}
|
}
|
||||||
return $this->_SSResiduals;
|
return $this->_SSResiduals;
|
||||||
} // function getSSResiduals()
|
} // function getSSResiduals()
|
||||||
|
|
||||||
|
public function getDFResiduals($dp = 0)
|
||||||
public function getDFResiduals($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_DFResiduals, $dp);
|
return round($this->_DFResiduals, $dp);
|
||||||
}
|
}
|
||||||
return $this->_DFResiduals;
|
return $this->_DFResiduals;
|
||||||
} // function getDFResiduals()
|
} // function getDFResiduals()
|
||||||
|
|
||||||
|
public function getF($dp = 0)
|
||||||
public function getF($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_F, $dp);
|
return round($this->_F, $dp);
|
||||||
}
|
}
|
||||||
return $this->_F;
|
return $this->_F;
|
||||||
} // function getF()
|
} // function getF()
|
||||||
|
|
||||||
|
public function getCovariance($dp = 0)
|
||||||
public function getCovariance($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_covariance, $dp);
|
return round($this->_covariance, $dp);
|
||||||
}
|
}
|
||||||
return $this->_covariance;
|
return $this->_covariance;
|
||||||
} // function getCovariance()
|
} // function getCovariance()
|
||||||
|
|
||||||
|
public function getCorrelation($dp = 0)
|
||||||
public function getCorrelation($dp=0) {
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_correlation, $dp);
|
return round($this->_correlation, $dp);
|
||||||
}
|
}
|
||||||
return $this->_correlation;
|
return $this->_correlation;
|
||||||
} // function getCorrelation()
|
} // function getCorrelation()
|
||||||
|
|
||||||
|
public function getYBestFitValues()
|
||||||
public function getYBestFitValues() {
|
{
|
||||||
return $this->_yBestFitValues;
|
return $this->_yBestFitValues;
|
||||||
} // function getYBestFitValues()
|
} // function getYBestFitValues()
|
||||||
|
|
||||||
|
protected function _calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const)
|
||||||
protected function _calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) {
|
{
|
||||||
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
||||||
foreach ($this->_xValues as $xKey => $xValue) {
|
foreach ($this->_xValues as $xKey => $xValue) {
|
||||||
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||||
|
@ -364,8 +365,8 @@ class PHPExcel_Best_Fit
|
||||||
}
|
}
|
||||||
} // function _calculateGoodnessOfFit()
|
} // function _calculateGoodnessOfFit()
|
||||||
|
|
||||||
|
protected function _leastSquareFit($yValues, $xValues, $const)
|
||||||
protected function _leastSquareFit($yValues, $xValues, $const) {
|
{
|
||||||
// calculate sums
|
// calculate sums
|
||||||
$x_sum = array_sum($xValues);
|
$x_sum = array_sum($xValues);
|
||||||
$y_sum = array_sum($yValues);
|
$y_sum = array_sum($yValues);
|
||||||
|
@ -401,7 +402,6 @@ class PHPExcel_Best_Fit
|
||||||
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
|
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
|
||||||
} // function _leastSquareFit()
|
} // function _leastSquareFit()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression
|
* Define the regression
|
||||||
*
|
*
|
||||||
|
@ -409,7 +409,8 @@ class PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues = array(), $const = true)
|
||||||
|
{
|
||||||
// Calculate number of points
|
// Calculate number of points
|
||||||
$nY = count($yValues);
|
$nY = count($yValues);
|
||||||
$nX = count($xValues);
|
$nX = count($xValues);
|
||||||
|
@ -420,13 +421,12 @@ class PHPExcel_Best_Fit
|
||||||
$nX = $nY;
|
$nX = $nY;
|
||||||
} elseif ($nY != $nX) {
|
} elseif ($nY != $nX) {
|
||||||
// Ensure both arrays of points are the same size
|
// Ensure both arrays of points are the same size
|
||||||
$this->_error = True;
|
$this->_error = true;
|
||||||
return False;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_valueCount = $nY;
|
$this->_valueCount = $nY;
|
||||||
$this->_xValues = $xValues;
|
$this->_xValues = $xValues;
|
||||||
$this->_yValues = $yValues;
|
$this->_yValues = $yValues;
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
}
|
||||||
} // class bestFit
|
|
||||||
|
|
|
@ -46,71 +46,70 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'exponential';
|
protected $_bestFitType = 'exponential';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
|
{
|
||||||
return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
|
return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
|
{
|
||||||
return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope());
|
return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope());
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' * '.$slope.'^X';
|
return 'Y = '.$intersect.' * '.$slope.'^X';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Slope of the line
|
* Return the Slope of the line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_slope), $dp);
|
return round(exp($this->_slope), $dp);
|
||||||
}
|
}
|
||||||
return exp($this->_slope);
|
return exp($this->_slope);
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Value of X where it intersects Y = 0
|
* Return the Value of X where it intersects Y = 0
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_intersect), $dp);
|
return round(exp($this->_intersect), $dp);
|
||||||
}
|
}
|
||||||
return exp($this->_intersect);
|
return exp($this->_intersect);
|
||||||
} // function getIntersect()
|
} // function getIntersect()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -118,7 +117,8 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _exponential_regression($yValues, $xValues, $const) {
|
private function _exponential_regression($yValues, $xValues, $const)
|
||||||
|
{
|
||||||
foreach ($yValues as &$value) {
|
foreach ($yValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
|
@ -131,7 +131,6 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _exponential_regression()
|
} // function _exponential_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -139,10 +138,10 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues = array(), $const = true)
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
{
|
||||||
|
if (parent::__construct($yValues, $xValues) !== false) {
|
||||||
$this->_exponential_regression($yValues, $xValues, $const);
|
$this->_exponential_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
}
|
||||||
} // class exponentialBestFit
|
|
|
@ -25,10 +25,8 @@
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Linear_Best_Fit
|
* PHPExcel_Linear_Best_Fit
|
||||||
*
|
*
|
||||||
|
@ -46,25 +44,25 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'linear';
|
protected $_bestFitType = 'linear';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
|
{
|
||||||
return $this->getIntersect() + $this->getSlope() * $xValue;
|
return $this->getIntersect() + $this->getSlope() * $xValue;
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
|
{
|
||||||
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
@ -75,14 +73,14 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' + '.$slope.' * X';
|
return 'Y = '.$intersect.' + '.$slope.' * X';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -90,11 +88,11 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _linear_regression($yValues, $xValues, $const) {
|
private function _linear_regression($yValues, $xValues, $const)
|
||||||
|
{
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _linear_regression()
|
} // function _linear_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -102,10 +100,10 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues = array(), $const = true)
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
{
|
||||||
|
if (parent::__construct($yValues, $xValues) !== false) {
|
||||||
$this->_linear_regression($yValues, $xValues, $const);
|
$this->_linear_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
}
|
||||||
} // class linearBestFit
|
|
|
@ -25,10 +25,8 @@
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Logarithmic_Best_Fit
|
* PHPExcel_Logarithmic_Best_Fit
|
||||||
*
|
*
|
||||||
|
@ -46,43 +44,42 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'logarithmic';
|
protected $_bestFitType = 'logarithmic';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
|
{
|
||||||
return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset);
|
return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset);
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
|
{
|
||||||
return exp(($yValue - $this->getIntersect()) / $this->getSlope());
|
return exp(($yValue - $this->getIntersect()) / $this->getSlope());
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' + '.$slope.' * log(X)';
|
return 'Y = '.$intersect.' + '.$slope.' * log(X)';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -90,7 +87,8 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _logarithmic_regression($yValues, $xValues, $const) {
|
private function _logarithmic_regression($yValues, $xValues, $const)
|
||||||
|
{
|
||||||
foreach ($xValues as &$value) {
|
foreach ($xValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
|
@ -103,7 +101,6 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _logarithmic_regression()
|
} // function _logarithmic_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
|
@ -111,10 +108,10 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues = array(), $const = true)
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
{
|
||||||
|
if (parent::__construct($yValues, $xValues) !== false) {
|
||||||
$this->_logarithmic_regression($yValues, $xValues, $const);
|
$this->_logarithmic_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
}
|
||||||
} // class logarithmicBestFit
|
|
|
@ -61,7 +61,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
**/
|
**/
|
||||||
public function getOrder() {
|
public function getOrder()
|
||||||
|
{
|
||||||
return $this->_order;
|
return $this->_order;
|
||||||
} // function getOrder()
|
} // function getOrder()
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
|
{
|
||||||
$retVal = $this->getIntersect();
|
$retVal = $this->getIntersect();
|
||||||
$slope = $this->getSlope();
|
$slope = $this->getSlope();
|
||||||
foreach ($slope as $key => $value) {
|
foreach ($slope as $key => $value) {
|
||||||
|
@ -90,7 +92,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
|
{
|
||||||
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
@ -101,7 +104,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
|
@ -124,7 +128,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
$coefficients = array();
|
$coefficients = array();
|
||||||
foreach ($this->_slope as $coefficient) {
|
foreach ($this->_slope as $coefficient) {
|
||||||
|
@ -136,7 +141,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
public function getCoefficients($dp=0) {
|
public function getCoefficients($dp = 0)
|
||||||
|
{
|
||||||
return array_merge(array($this->getIntersect($dp)), $this->getSlope($dp));
|
return array_merge(array($this->getIntersect($dp)), $this->getSlope($dp));
|
||||||
} // function getCoefficients()
|
} // function getCoefficients()
|
||||||
|
|
||||||
|
@ -149,7 +155,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _polynomial_regression($order, $yValues, $xValues, $const) {
|
private function _polynomial_regression($order, $yValues, $xValues, $const)
|
||||||
|
{
|
||||||
// calculate sums
|
// calculate sums
|
||||||
$x_sum = array_sum($xValues);
|
$x_sum = array_sum($xValues);
|
||||||
$y_sum = array_sum($yValues);
|
$y_sum = array_sum($yValues);
|
||||||
|
@ -206,8 +213,9 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($order, $yValues, $xValues=array(), $const=True) {
|
function __construct($order, $yValues, $xValues = array(), $const = true)
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
{
|
||||||
|
if (parent::__construct($yValues, $xValues) !== false) {
|
||||||
if ($order < $this->_valueCount) {
|
if ($order < $this->_valueCount) {
|
||||||
$this->_bestFitType .= '_'.$order;
|
$this->_bestFitType .= '_'.$order;
|
||||||
$this->_order = $order;
|
$this->_order = $order;
|
||||||
|
@ -220,5 +228,4 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
}
|
||||||
} // class polynomialBestFit
|
|
|
@ -53,7 +53,8 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue)
|
||||||
|
{
|
||||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset), $this->getSlope());
|
return $this->getIntersect() * pow(($xValue - $this->_Xoffset), $this->getSlope());
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
@ -64,7 +65,8 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue)
|
||||||
|
{
|
||||||
return pow((($yValue + $this->_Yoffset) / $this->getIntersect()), (1 / $this->getSlope()));
|
return pow((($yValue + $this->_Yoffset) / $this->getIntersect()), (1 / $this->getSlope()));
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
@ -75,7 +77,8 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp = 0)
|
||||||
|
{
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
|
@ -89,7 +92,8 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp = 0)
|
||||||
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_intersect), $dp);
|
return round(exp($this->_intersect), $dp);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +108,8 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _power_regression($yValues, $xValues, $const) {
|
private function _power_regression($yValues, $xValues, $const)
|
||||||
|
{
|
||||||
foreach ($xValues as &$value) {
|
foreach ($xValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
|
@ -133,10 +138,10 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues = array(), $const = true)
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
{
|
||||||
|
if (parent::__construct($yValues, $xValues) !== false) {
|
||||||
$this->_power_regression($yValues, $xValues, $const);
|
$this->_power_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
}
|
||||||
|
}
|
||||||
} // class powerBestFit
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ class trendClass
|
||||||
private static $_trendCache = array();
|
private static $_trendCache = array();
|
||||||
|
|
||||||
|
|
||||||
public static function calculate($trendType=self::TREND_BEST_FIT, $yValues, $xValues=array(), $const=True) {
|
public static function calculate($trendType = self::TREND_BEST_FIT, $yValues, $xValues = array(), $const = true)
|
||||||
|
{
|
||||||
// Calculate number of points in each dataset
|
// Calculate number of points in each dataset
|
||||||
$nY = count($yValues);
|
$nY = count($yValues);
|
||||||
$nX = count($xValues);
|
$nX = count($xValues);
|
||||||
|
@ -152,5 +153,4 @@ class trendClass
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // function calculate()
|
} // function calculate()
|
||||||
|
|
||||||
} // class trendClass
|
} // class trendClass
|
|
@ -2502,9 +2502,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
$style = $this->_parent->getCellXfByIndex($cell->getXfIndex());
|
$style = $this->_parent->getCellXfByIndex($cell->getXfIndex());
|
||||||
$returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString(
|
$returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString(
|
||||||
$returnValue[$rRef][$cRef],
|
$returnValue[$rRef][$cRef],
|
||||||
($style && $style->getNumberFormat()) ?
|
($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : PHPExcel_Style_NumberFormat::FORMAT_GENERAL
|
||||||
$style->getNumberFormat()->getFormatCode() :
|
|
||||||
PHPExcel_Style_NumberFormat::FORMAT_GENERAL
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2833,9 +2831,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*/
|
*/
|
||||||
public function getTabColor()
|
public function getTabColor()
|
||||||
{
|
{
|
||||||
if ($this->_tabColor === null)
|
if ($this->_tabColor === null) {
|
||||||
$this->_tabColor = new PHPExcel_Style_Color();
|
$this->_tabColor = new PHPExcel_Style_Color();
|
||||||
|
}
|
||||||
return $this->_tabColor;
|
return $this->_tabColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2867,7 +2865,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function copy() {
|
public function copy()
|
||||||
|
{
|
||||||
$copied = clone $this;
|
$copied = clone $this;
|
||||||
|
|
||||||
return $copied;
|
return $copied;
|
||||||
|
|
|
@ -620,8 +620,9 @@ class PHPExcel_Worksheet_AutoFilter
|
||||||
// Test if we want to include blanks in our filter criteria
|
// Test if we want to include blanks in our filter criteria
|
||||||
$blanks = false;
|
$blanks = false;
|
||||||
$ruleDataSet = array_filter($ruleValues);
|
$ruleDataSet = array_filter($ruleValues);
|
||||||
if (count($ruleValues) != count($ruleDataSet))
|
if (count($ruleValues) != count($ruleDataSet)) {
|
||||||
$blanks = true;
|
$blanks = true;
|
||||||
|
}
|
||||||
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
|
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
|
||||||
// Filter on absolute values
|
// Filter on absolute values
|
||||||
$columnFilterTests[$columnID] = array(
|
$columnFilterTests[$columnID] = array(
|
||||||
|
@ -638,23 +639,29 @@ class PHPExcel_Worksheet_AutoFilter
|
||||||
foreach ($ruleDataSet as $ruleValue) {
|
foreach ($ruleDataSet as $ruleValue) {
|
||||||
$date = $time = '';
|
$date = $time = '';
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) {
|
||||||
$date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
$date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
||||||
|
}
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) {
|
||||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
||||||
|
}
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) {
|
||||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
||||||
|
}
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) {
|
||||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
||||||
|
}
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) {
|
||||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
||||||
|
}
|
||||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
|
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
|
||||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== ''))
|
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) {
|
||||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
||||||
|
}
|
||||||
$dateTime = $date . $time;
|
$dateTime = $date . $time;
|
||||||
$arguments['date'][] = $date;
|
$arguments['date'][] = $date;
|
||||||
$arguments['time'][] = $time;
|
$arguments['time'][] = $time;
|
||||||
|
@ -727,7 +734,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||||
--$period;
|
--$period;
|
||||||
$periodEnd = (1+$period)*3;
|
$periodEnd = (1+$period)*3;
|
||||||
$periodStart = 1+$period*3;
|
$periodStart = 1+$period*3;
|
||||||
$ruleValues = range($periodStart,periodEnd);
|
$ruleValues = range($periodStart, $periodEnd);
|
||||||
}
|
}
|
||||||
$columnFilterTests[$columnID] = array(
|
$columnFilterTests[$columnID] = array(
|
||||||
'method' => '_filterTestInPeriodDateSet',
|
'method' => '_filterTestInPeriodDateSet',
|
||||||
|
@ -754,8 +761,12 @@ class PHPExcel_Worksheet_AutoFilter
|
||||||
if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) {
|
if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) {
|
||||||
$ruleValue = floor($ruleValue * ($dataRowCount / 100));
|
$ruleValue = floor($ruleValue * ($dataRowCount / 100));
|
||||||
}
|
}
|
||||||
if ($ruleValue < 1) $ruleValue = 1;
|
if ($ruleValue < 1) {
|
||||||
if ($ruleValue > 500) $ruleValue = 500;
|
$ruleValue = 1;
|
||||||
|
}
|
||||||
|
if ($ruleValue > 500) {
|
||||||
|
$ruleValue = 500;
|
||||||
|
}
|
||||||
|
|
||||||
$maxVal = $this->_calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
|
$maxVal = $this->_calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
|
||||||
|
|
||||||
|
@ -836,7 +847,8 @@ class PHPExcel_Worksheet_AutoFilter
|
||||||
* toString method replicates previous behavior by returning the range if object is
|
* toString method replicates previous behavior by returning the range if object is
|
||||||
* referenced as a property of its parent.
|
* referenced as a property of its parent.
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
|
{
|
||||||
return (string) $this->_range;
|
return (string) $this->_range;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,8 @@ class PHPExcel_Worksheet_PageSetup
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getFitToPage() {
|
public function getFitToPage()
|
||||||
|
{
|
||||||
return $this->_fitToPage;
|
return $this->_fitToPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue