namespacing in calculation functions

This commit is contained in:
MarkBaker 2015-05-30 15:56:59 +01:00
parent ee04f30d67
commit 621fc9aec7
12 changed files with 230 additions and 230 deletions

View File

@ -91,7 +91,7 @@ class DateTime
(Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) { (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
return Functions::VALUE(); return Functions::VALUE();
} }
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
$dateValue = \PHPExcel\Shared\Date::PHPToExcel($dateValue); $dateValue = \PHPExcel\Shared\Date::PHPToExcel($dateValue);
} else { } else {
$saveReturnDateType = Functions::getReturnDateType(); $saveReturnDateType = Functions::getReturnDateType();
@ -179,7 +179,7 @@ class DateTime
$retValue = (integer) time(); $retValue = (integer) time();
break; break;
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
$retValue = new DateTime(); $retValue = new \DateTime();
break; break;
} }
date_default_timezone_set($saveTimeZone); date_default_timezone_set($saveTimeZone);
@ -448,7 +448,7 @@ class DateTime
$dayAdjust = floor($hour / 24); $dayAdjust = floor($hour / 24);
$hour = $hour % 24; $hour = $hour % 24;
} }
$phpDateObject = new DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second);
if ($dayAdjust != 0) { if ($dayAdjust != 0) {
$phpDateObject->modify($dayAdjust.' days'); $phpDateObject->modify($dayAdjust.' days');
} }
@ -559,7 +559,7 @@ class DateTime
$PHPDateArray['day'] = strftime('%d'); $PHPDateArray['day'] = strftime('%d');
} }
$excelDateValue = floor( $excelDateValue = floor(
PHPExcel_Shared_Date::FormattedPHPToExcel( \PHPExcel\Shared\Date::FormattedPHPToExcel(
$PHPDateArray['year'], $PHPDateArray['year'],
$PHPDateArray['month'], $PHPDateArray['month'],
$PHPDateArray['day'], $PHPDateArray['day'],
@ -573,9 +573,9 @@ class DateTime
case Functions::RETURNDATE_EXCEL: case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue; return (float) $excelDateValue;
case Functions::RETURNDATE_PHP_NUMERIC: case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); return (integer) \PHPExcel\Shared\Date::ExcelToPHP($excelDateValue);
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00');
} }
} }
return Functions::VALUE(); return Functions::VALUE();
@ -612,7 +612,7 @@ class DateTime
$PHPDateArray = date_parse($timeValue); $PHPDateArray = date_parse($timeValue);
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) { if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel( $excelDateValue = \PHPExcel\Shared\Date::FormattedPHPToExcel(
$PHPDateArray['year'], $PHPDateArray['year'],
$PHPDateArray['month'], $PHPDateArray['month'],
$PHPDateArray['day'], $PHPDateArray['day'],
@ -621,16 +621,16 @@ class DateTime
$PHPDateArray['second'] $PHPDateArray['second']
); );
} else { } else {
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1; $excelDateValue = \PHPExcel\Shared\Date::FormattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
} }
switch (Functions::getReturnDateType()) { switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL: case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue; return (float) $excelDateValue;
case Functions::RETURNDATE_PHP_NUMERIC: case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600; return (integer) $phpDateValue = \PHPExcel\Shared\Date::ExcelToPHP($excelDateValue+25569) - 3600;
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
} }
} }
return Functions::VALUE(); return Functions::VALUE();
@ -668,12 +668,12 @@ class DateTime
// Execute function // Execute function
$difference = $endDate - $startDate; $difference = $endDate - $startDate;
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); $PHPStartDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($startDate);
$startDays = $PHPStartDateObject->format('j'); $startDays = $PHPStartDateObject->format('j');
$startMonths = $PHPStartDateObject->format('n'); $startMonths = $PHPStartDateObject->format('n');
$startYears = $PHPStartDateObject->format('Y'); $startYears = $PHPStartDateObject->format('Y');
$PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); $PHPEndDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($endDate);
$endDays = $PHPEndDateObject->format('j'); $endDays = $PHPEndDateObject->format('j');
$endMonths = $PHPEndDateObject->format('n'); $endMonths = $PHPEndDateObject->format('n');
$endYears = $PHPEndDateObject->format('Y'); $endYears = $PHPEndDateObject->format('Y');
@ -787,12 +787,12 @@ class DateTime
} }
// Execute function // Execute function
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); $PHPStartDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($startDate);
$startDay = $PHPStartDateObject->format('j'); $startDay = $PHPStartDateObject->format('j');
$startMonth = $PHPStartDateObject->format('n'); $startMonth = $PHPStartDateObject->format('n');
$startYear = $PHPStartDateObject->format('Y'); $startYear = $PHPStartDateObject->format('Y');
$PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); $PHPEndDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($endDate);
$endDay = $PHPEndDateObject->format('j'); $endDay = $PHPEndDateObject->format('j');
$endMonth = $PHPEndDateObject->format('n'); $endMonth = $PHPEndDateObject->format('n');
$endYear = $PHPEndDateObject->format('Y'); $endYear = $PHPEndDateObject->format('Y');
@ -1094,9 +1094,9 @@ class DateTime
case Functions::RETURNDATE_EXCEL: case Functions::RETURNDATE_EXCEL:
return (float) $endDate; return (float) $endDate;
case Functions::RETURNDATE_PHP_NUMERIC: case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate); return (integer) \PHPExcel\Shared\Date::ExcelToPHP($endDate);
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
return PHPExcel_Shared_Date::ExcelToPHPObject($endDate); return \PHPExcel\Shared\Date::ExcelToPHPObject($endDate);
} }
} }
@ -1129,7 +1129,7 @@ class DateTime
} }
// Execute function // Execute function
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
return (int) $PHPDateObject->format('j'); return (int) $PHPDateObject->format('j');
} }
@ -1173,7 +1173,7 @@ class DateTime
} }
// Execute function // Execute function
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
$DoW = $PHPDateObject->format('w'); $DoW = $PHPDateObject->format('w');
$firstDay = 1; $firstDay = 1;
@ -1249,7 +1249,7 @@ class DateTime
} }
// Execute function // Execute function
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
$dayOfYear = $PHPDateObject->format('z'); $dayOfYear = $PHPDateObject->format('z');
$dow = $PHPDateObject->format('w'); $dow = $PHPDateObject->format('w');
$PHPDateObject->modify('-' . $dayOfYear . ' days'); $PHPDateObject->modify('-' . $dayOfYear . ' days');
@ -1288,7 +1288,7 @@ class DateTime
} }
// Execute function // Execute function
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
return (int) $PHPDateObject->format('n'); return (int) $PHPDateObject->format('n');
} }
@ -1320,7 +1320,7 @@ class DateTime
} }
// Execute function // Execute function
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
return (int) $PHPDateObject->format('Y'); return (int) $PHPDateObject->format('Y');
} }
@ -1361,7 +1361,7 @@ class DateTime
} elseif ($timeValue < 0.0) { } elseif ($timeValue < 0.0) {
return Functions::NaN(); return Functions::NaN();
} }
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); $timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
return (int) gmdate('G', $timeValue); return (int) gmdate('G', $timeValue);
} }
@ -1402,7 +1402,7 @@ class DateTime
} elseif ($timeValue < 0.0) { } elseif ($timeValue < 0.0) {
return Functions::NaN(); return Functions::NaN();
} }
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); $timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
return (int) gmdate('i', $timeValue); return (int) gmdate('i', $timeValue);
} }
@ -1443,7 +1443,7 @@ class DateTime
} elseif ($timeValue < 0.0) { } elseif ($timeValue < 0.0) {
return Functions::NaN(); return Functions::NaN();
} }
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); $timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
return (int) gmdate('s', $timeValue); return (int) gmdate('s', $timeValue);
} }
@ -1487,9 +1487,9 @@ class DateTime
switch (Functions::getReturnDateType()) { switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL: case Functions::RETURNDATE_EXCEL:
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject);
case Functions::RETURNDATE_PHP_NUMERIC: case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); return (integer) \PHPExcel\Shared\Date::ExcelToPHP(PHPExcel\Shared\Date::PHPToExcel($PHPDateObject));
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject; return $PHPDateObject;
} }
@ -1536,9 +1536,9 @@ class DateTime
switch (Functions::getReturnDateType()) { switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL: case Functions::RETURNDATE_EXCEL:
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject);
case Functions::RETURNDATE_PHP_NUMERIC: case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); return (integer) \PHPExcel\Shared\Date::ExcelToPHP(\PHPExcel\Shared\Date::PHPToExcel($PHPDateObject));
case Functions::RETURNDATE_PHP_OBJECT: case Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject; return $PHPDateObject;
} }

View File

@ -34,7 +34,7 @@ class ExceptionHandler
*/ */
public function __construct() public function __construct()
{ {
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL); set_error_handler(array('\\PHPExcel\\Calculation\\Exception', 'errorHandlerCallback'), E_ALL);
} }
/** /**

View File

@ -67,10 +67,10 @@ class Financial
{ {
$months = 12 / $frequency; $months = 12 / $frequency;
$result = PHPExcel_Shared_Date::ExcelToPHPObject($maturity); $result = \PHPExcel\Shared\Date::ExcelToPHPObject($maturity);
$eom = self::isLastDayOfMonth($result); $eom = self::isLastDayOfMonth($result);
while ($settlement < PHPExcel_Shared_Date::PHPToExcel($result)) { while ($settlement < \PHPExcel\Shared\Date::PHPToExcel($result)) {
$result->modify('-'.$months.' months'); $result->modify('-'.$months.' months');
} }
if ($next) { if ($next) {
@ -81,7 +81,7 @@ class Financial
$result->modify('-1 day'); $result->modify('-1 day');
} }
return PHPExcel_Shared_Date::PHPToExcel($result); return \PHPExcel\Shared\Date::PHPToExcel($result);
} }

View File

@ -79,21 +79,21 @@ class FormulaParser
/** /**
* Tokens * Tokens
* *
* @var PHPExcel_Calculation_FormulaToken[] * @var FormulaToken[]
*/ */
private $tokens = array(); private $tokens = array();
/** /**
* Create a new PHPExcel_Calculation_FormulaParser * Create a new FormulaParser
* *
* @param string $pFormula Formula to parse * @param string $pFormula Formula to parse
* @throws PHPExcel_Calculation_Exception * @throws Exception
*/ */
public function __construct($pFormula = '') public function __construct($pFormula = '')
{ {
// Check parameters // Check parameters
if (is_null($pFormula)) { if (is_null($pFormula)) {
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula"); throw new Exception("Invalid parameter passed: formula");
} }
// Initialise values // Initialise values
@ -117,14 +117,14 @@ class FormulaParser
* *
* @param int $pId Token id * @param int $pId Token id
* @return string * @return string
* @throws PHPExcel_Calculation_Exception * @throws Exception
*/ */
public function getToken($pId = 0) public function getToken($pId = 0)
{ {
if (isset($this->tokens[$pId])) { if (isset($this->tokens[$pId])) {
return $this->tokens[$pId]; return $this->tokens[$pId];
} else { } else {
throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist."); throw new Exception("Token with id $pId does not exist.");
} }
} }
@ -141,7 +141,7 @@ class FormulaParser
/** /**
* Get Tokens * Get Tokens
* *
* @return PHPExcel_Calculation_FormulaToken[] * @return FormulaToken[]
*/ */
public function getTokens() public function getTokens()
{ {
@ -180,13 +180,13 @@ class FormulaParser
// embeds are doubled // embeds are doubled
// end marks token // end marks token
if ($inString) { if ($inString) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { if ($this->formula{$index} == self::QUOTE_DOUBLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) { if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_DOUBLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE; $value .= self::QUOTE_DOUBLE;
++$index; ++$index;
} else { } else {
$inString = false; $inString = false;
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND, FormulaToken::TOKEN_SUBTYPE_TEXT);
$value = ""; $value = "";
} }
} else { } else {
@ -200,9 +200,9 @@ class FormulaParser
// embeds are double // embeds are double
// end does not mark a token // end does not mark a token
if ($inPath) { if ($inPath) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { if ($this->formula{$index} == self::QUOTE_SINGLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) { if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_SINGLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE; $value .= self::QUOTE_SINGLE;
++$index; ++$index;
} else { } else {
$inPath = false; $inPath = false;
@ -218,7 +218,7 @@ class FormulaParser
// no embeds (changed to "()" by Excel) // no embeds (changed to "()" by Excel)
// end does not mark a token // end does not mark a token
if ($inRange) { if ($inRange) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) { if ($this->formula{$index} == self::BRACKET_CLOSE) {
$inRange = false; $inRange = false;
} }
$value .= $this->formula{$index}; $value .= $this->formula{$index};
@ -233,14 +233,14 @@ class FormulaParser
++$index; ++$index;
if (in_array($value, $ERRORS)) { if (in_array($value, $ERRORS)) {
$inError = false; $inError = false;
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND, FormulaToken::TOKEN_SUBTYPE_ERROR);
$value = ""; $value = "";
} }
continue; continue;
} }
// scientific notation check // scientific notation check
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) { if (strpos(self::OPERATORS_SN, $this->formula{$index}) !== false) {
if (strlen($value) > 1) { if (strlen($value) > 1) {
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) { if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
$value .= $this->formula{$index}; $value .= $this->formula{$index};
@ -253,10 +253,10 @@ class FormulaParser
// independent character evaluation (order not important) // independent character evaluation (order not important)
// establish state-dependent character evaluations // establish state-dependent character evaluations
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { if ($this->formula{$index} == self::QUOTE_DOUBLE) {
if (strlen($value > 0)) { if (strlen($value > 0)) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
$value = ""; $value = "";
} }
$inString = true; $inString = true;
@ -264,10 +264,10 @@ class FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { if ($this->formula{$index} == self::QUOTE_SINGLE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
$value = ""; $value = "";
} }
$inPath = true; $inPath = true;
@ -275,38 +275,38 @@ class FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) { if ($this->formula{$index} == self::BRACKET_OPEN) {
$inRange = true; $inRange = true;
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN; $value .= self::BRACKET_OPEN;
++$index; ++$index;
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) { if ($this->formula{$index} == self::ERROR_START) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
$value = ""; $value = "";
} }
$inError = true; $inError = true;
$value .= PHPExcel_Calculation_FormulaParser::ERROR_START; $value .= self::ERROR_START;
++$index; ++$index;
continue; continue;
} }
// mark start and end of arrays and array rows // mark start and end of arrays and array rows
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) { if ($this->formula{$index} == self::BRACE_OPEN) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
$value = ""; $value = "";
} }
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new FormulaToken("ARRAY", FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$stack[] = clone $tmp; $stack[] = clone $tmp;
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new FormulaToken("ARRAYROW", FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$stack[] = clone $tmp; $stack[] = clone $tmp;
@ -314,21 +314,21 @@ class FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) { if ($this->formula{$index} == self::SEMICOLON) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tmp = array_pop($stack); $tmp = array_pop($stack);
$tmp->setValue(""); $tmp->setValue("");
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); $tmp = new FormulaToken(",", FormulaToken::TOKEN_TYPE_ARGUMENT);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new FormulaToken("ARRAYROW", FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$stack[] = clone $tmp; $stack[] = clone $tmp;
@ -336,20 +336,20 @@ class FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) { if ($this->formula{$index} == self::BRACE_CLOSE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tmp = array_pop($stack); $tmp = array_pop($stack);
$tmp->setValue(""); $tmp->setValue("");
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$tmp = array_pop($stack); $tmp = array_pop($stack);
$tmp->setValue(""); $tmp->setValue("");
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$tokens1[] = $tmp; $tokens1[] = $tmp;
++$index; ++$index;
@ -357,14 +357,14 @@ class FormulaParser
} }
// trim white-space // trim white-space
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) { if ($this->formula{$index} == self::WHITESPACE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE); $tokens1[] = new FormulaToken("", FormulaToken::TOKEN_TYPE_WHITESPACE);
++$index; ++$index;
while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) { while (($this->formula{$index} == self::WHITESPACE) && ($index < $formulaLength)) {
++$index; ++$index;
} }
continue; continue;
@ -374,46 +374,46 @@ class FormulaParser
if (($index + 2) <= $formulaLength) { if (($index + 2) <= $formulaLength) {
if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) { if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); $tokens1[] = new FormulaToken(substr($this->formula, $index, 2), FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_LOGICAL);
$index += 2; $index += 2;
continue; continue;
} }
} }
// standard infix operators // standard infix operators
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) { if (strpos(self::OPERATORS_INFIX, $this->formula{$index}) !== false) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] =new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX); $tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORINFIX);
++$index; ++$index;
continue; continue;
} }
// standard postfix operators (only one) // standard postfix operators (only one)
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) { if (strpos(self::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); $tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
++$index; ++$index;
continue; continue;
} }
// start subexpression or function // start subexpression or function
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) { if ($this->formula{$index} == self::PAREN_OPEN) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new FormulaToken($value, FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$stack[] = clone $tmp; $stack[] = clone $tmp;
$value = ""; $value = "";
} else { } else {
$tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new FormulaToken("", FormulaToken::TOKEN_TYPE_SUBEXPRESSION, FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
$stack[] = clone $tmp; $stack[] = clone $tmp;
} }
@ -422,36 +422,36 @@ class FormulaParser
} }
// function, subexpression, or array parameters, or operand unions // function, subexpression, or array parameters, or operand unions
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) { if ($this->formula{$index} == self::COMMA) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tmp = array_pop($stack); $tmp = array_pop($stack);
$tmp->setValue(""); $tmp->setValue("");
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$stack[] = $tmp; $stack[] = $tmp;
if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { if ($tmp->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION); $tokens1[] = new FormulaToken(",", FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_UNION);
} else { } else {
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); $tokens1[] = new FormulaToken(",", FormulaToken::TOKEN_TYPE_ARGUMENT);
} }
++$index; ++$index;
continue; continue;
} }
// stop subexpression // stop subexpression
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) { if ($this->formula{$index} == self::PAREN_CLOSE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tmp = array_pop($stack); $tmp = array_pop($stack);
$tmp->setValue(""); $tmp->setValue("");
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$tokens1[] = $tmp; $tokens1[] = $tmp;
++$index; ++$index;
@ -465,7 +465,7 @@ class FormulaParser
// dump remaining accumulation // dump remaining accumulation
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
} }
// move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections
@ -487,7 +487,7 @@ class FormulaParser
continue; continue;
} }
if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) { if ($token->getTokenType() != FormulaToken::TOKEN_TYPE_WHITESPACE) {
$tokens2[] = $token; $tokens2[] = $token;
continue; continue;
} }
@ -497,9 +497,9 @@ class FormulaParser
} }
if (! ( if (! (
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
) ) { ) ) {
continue; continue;
} }
@ -509,14 +509,14 @@ class FormulaParser
} }
if (! ( if (! (
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) ||
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) ||
($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
) ) { ) ) {
continue; continue;
} }
$tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION); $tokens2[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_INTERSECTION);
} }
// move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators
@ -541,34 +541,34 @@ class FormulaParser
continue; continue;
} }
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") { if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
if ($i == 0) { if ($i == 0) {
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); $token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && } elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) &&
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) { ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
} else { } else {
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); $token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
} }
$this->tokens[] = $token; $this->tokens[] = $token;
continue; continue;
} }
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") { if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
if ($i == 0) { if ($i == 0) {
continue; continue;
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && } elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) &&
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) { ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
} else { } else {
continue; continue;
} }
@ -577,37 +577,37 @@ class FormulaParser
continue; continue;
} }
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { $token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) { if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL);
} elseif ($token->getValue() == "&") { } elseif ($token->getValue() == "&") {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
} else { } else {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
} }
$this->tokens[] = $token; $this->tokens[] = $token;
continue; continue;
} }
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND && if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND &&
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { $token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
if (!is_numeric($token->getValue())) { if (!is_numeric($token->getValue())) {
if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) { if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL);
} else { } else {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_RANGE);
} }
} else { } else {
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER); $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_NUMBER);
} }
$this->tokens[] = $token; $this->tokens[] = $token;
continue; continue;
} }
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
if (strlen($token->getValue() > 0)) { if (strlen($token->getValue() > 0)) {
if (substr($token->getValue(), 0, 1) == "@") { if (substr($token->getValue(), 0, 1) == "@") {
$token->setValue(substr($token->getValue(), 1)); $token->setValue(substr($token->getValue(), 1));

View File

@ -100,16 +100,16 @@ class FormulaToken
private $tokenSubType; private $tokenSubType;
/** /**
* Create a new PHPExcel_Calculation_FormulaToken * Create a new FormulaToken
* *
* @param string $pValue * @param string $pValue
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*) * @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*)
*/ */
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) public function __construct($pValue, $pTokenType = self::TOKEN_TYPE_UNKNOWN, $pTokenSubType = self::TOKEN_SUBTYPE_NOTHING)
{ {
// Initialise values // Initialise values
$this->value = $pValue; $this->value = $pValue;
$this->tokenType = $pTokenType; $this->tokenType = $pTokenType;
$this->tokenSubType = $pTokenSubType; $this->tokenSubType = $pTokenSubType;
} }
@ -149,7 +149,7 @@ class FormulaToken
* *
* @param string $value * @param string $value
*/ */
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) public function setTokenType($value = self::TOKEN_TYPE_UNKNOWN)
{ {
$this->tokenType = $value; $this->tokenType = $value;
} }
@ -169,7 +169,7 @@ class FormulaToken
* *
* @param string $value * @param string $value
*/ */
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) public function setTokenSubType($value = self::TOKEN_SUBTYPE_NOTHING)
{ {
$this->tokenSubType = $value; $this->tokenSubType = $value;
} }

View File

@ -35,10 +35,10 @@ define('PRECISION', 8.88E-016);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Calculation * @package PHPExcel_Calculation
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @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 Functions class Functions
{ {
@ -314,7 +314,7 @@ class Functions
} }
if (!in_array($condition{0}, array('>', '<', '='))) { if (!in_array($condition{0}, array('>', '<', '='))) {
if (!is_numeric($condition)) { if (!is_numeric($condition)) {
$condition = PHPExcel_Calculation::wrapResult(strtoupper($condition)); $condition = \PHPExcel\Calculation::wrapResult(strtoupper($condition));
} }
return '=' . $condition; return '=' . $condition;
} else { } else {
@ -323,7 +323,7 @@ class Functions
if (!is_numeric($operand)) { if (!is_numeric($operand)) {
$operand = str_replace('"', '""', $operand); $operand = str_replace('"', '""', $operand);
$operand = PHPExcel_Calculation::wrapResult(strtoupper($operand)); $operand = \PHPExcel\Calculation::wrapResult(strtoupper($operand));
} }
return $operator.$operand; return $operator.$operand;

View File

@ -27,7 +27,7 @@ namespace PHPExcel\Calculation;
* @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_Calculation_Logical class Logical
{ {
/** /**
* TRUE * TRUE
@ -102,9 +102,9 @@ class PHPExcel_Calculation_Logical
$returnValue = $returnValue && ($arg != 0); $returnValue = $returnValue && ($arg != 0);
} elseif (is_string($arg)) { } elseif (is_string($arg)) {
$arg = strtoupper($arg); $arg = strtoupper($arg);
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { if (($arg == 'TRUE') || ($arg == \PHPExcel\Calculation::getTRUE())) {
$arg = true; $arg = true;
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { } elseif (($arg == 'FALSE') || ($arg == \PHPExcel\Calculation::getFALSE())) {
$arg = false; $arg = false;
} else { } else {
return Functions::VALUE(); return Functions::VALUE();
@ -158,9 +158,9 @@ class PHPExcel_Calculation_Logical
$returnValue = $returnValue || ($arg != 0); $returnValue = $returnValue || ($arg != 0);
} elseif (is_string($arg)) { } elseif (is_string($arg)) {
$arg = strtoupper($arg); $arg = strtoupper($arg);
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { if (($arg == 'TRUE') || ($arg == \PHPExcel\Calculation::getTRUE())) {
$arg = true; $arg = true;
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { } elseif (($arg == 'FALSE') || ($arg == \PHPExcel\Calculation::getFALSE())) {
$arg = false; $arg = false;
} else { } else {
return Functions::VALUE(); return Functions::VALUE();
@ -202,9 +202,9 @@ class PHPExcel_Calculation_Logical
$logical = Functions::flattenSingleValue($logical); $logical = Functions::flattenSingleValue($logical);
if (is_string($logical)) { if (is_string($logical)) {
$logical = strtoupper($logical); $logical = strtoupper($logical);
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) { if (($logical == 'TRUE') || ($logical == \PHPExcel\Calculation::getTRUE())) {
return false; return false;
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) { } elseif (($logical == 'FALSE') || ($logical == \PHPExcel\Calculation::getFALSE())) {
return true; return true;
} else { } else {
return Functions::VALUE(); return Functions::VALUE();

View File

@ -22,10 +22,10 @@ namespace PHPExcel\Calculation;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Calculation * @package PHPExcel_Calculation
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @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 LookupRef class LookupRef
{ {
@ -69,7 +69,7 @@ class LookupRef
} }
if ((!is_bool($referenceStyle)) || $referenceStyle) { if ((!is_bool($referenceStyle)) || $referenceStyle) {
$rowRelative = $columnRelative = '$'; $rowRelative = $columnRelative = '$';
$column = PHPExcel_Cell::stringFromColumnIndex($column-1); $column = \PHPExcel\Cell::stringFromColumnIndex($column-1);
if (($relativity == 2) || ($relativity == 4)) { if (($relativity == 2) || ($relativity == 4)) {
$columnRelative = ''; $columnRelative = '';
} }
@ -112,7 +112,7 @@ class LookupRef
if (is_array($cellAddress)) { if (is_array($cellAddress)) {
foreach ($cellAddress as $columnKey => $value) { foreach ($cellAddress as $columnKey => $value) {
$columnKey = preg_replace('/[^a-z]/i', '', $columnKey); $columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
return (integer) PHPExcel_Cell::columnIndexFromString($columnKey); return (integer) \PHPExcel\Cell::columnIndexFromString($columnKey);
} }
} else { } else {
if (strpos($cellAddress, '!') !== false) { if (strpos($cellAddress, '!') !== false) {
@ -124,12 +124,12 @@ class LookupRef
$endAddress = preg_replace('/[^a-z]/i', '', $endAddress); $endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
$returnValue = array(); $returnValue = array();
do { do {
$returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress); $returnValue[] = (integer) \PHPExcel\Cell::columnIndexFromString($startAddress);
} while ($startAddress++ != $endAddress); } while ($startAddress++ != $endAddress);
return $returnValue; return $returnValue;
} else { } else {
$cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress); $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress);
return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress); return (integer) \PHPExcel\Cell::columnIndexFromString($cellAddress);
} }
} }
} }
@ -156,7 +156,7 @@ class LookupRef
reset($cellAddress); reset($cellAddress);
$isMatrix = (is_numeric(key($cellAddress))); $isMatrix = (is_numeric(key($cellAddress)));
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); list($columns, $rows) = \PHPExcel\Calculation::_getMatrixDimensions($cellAddress);
if ($isMatrix) { if ($isMatrix) {
return $rows; return $rows;
@ -234,7 +234,7 @@ class LookupRef
reset($cellAddress); reset($cellAddress);
$isMatrix = (is_numeric(key($cellAddress))); $isMatrix = (is_numeric(key($cellAddress)));
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); list($columns, $rows) = \PHPExcel\Calculation::_getMatrixDimensions($cellAddress);
if ($isMatrix) { if ($isMatrix) {
return $columns; return $columns;
@ -254,10 +254,10 @@ class LookupRef
* @category Logical Functions * @category Logical Functions
* @param string $linkURL Value to check, is also the value returned when no error * @param string $linkURL Value to check, is also the value returned when no error
* @param string $displayName Value to return when testValue is an error condition * @param string $displayName Value to return when testValue is an error condition
* @param PHPExcel_Cell $pCell The cell to set the hyperlink in * @param \PHPExcel\Cell $pCell The cell to set the hyperlink in
* @return mixed The value of $displayName (or $linkURL if $displayName was blank) * @return mixed The value of $displayName (or $linkURL if $displayName was blank)
*/ */
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) public static function HYPERLINK($linkURL = '', $displayName = null, \PHPExcel\Cell $pCell = null)
{ {
$args = func_get_args(); $args = func_get_args();
$pCell = array_pop($args); $pCell = array_pop($args);
@ -291,13 +291,13 @@ class LookupRef
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010 * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
* *
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula) * @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
* @param PHPExcel_Cell $pCell The current cell (containing this formula) * @param \PHPExcel\Cell $pCell The current cell (containing this formula)
* @return mixed The cells referenced by cellAddress * @return mixed The cells referenced by cellAddress
* *
* @todo Support for the optional a1 parameter introduced in Excel 2010 * @todo Support for the optional a1 parameter introduced in Excel 2010
* *
*/ */
public static function INDIRECT($cellAddress = null, PHPExcel_Cell $pCell = null) public static function INDIRECT($cellAddress = null, \PHPExcel\Cell $pCell = null)
{ {
$cellAddress = Functions::flattenSingleValue($cellAddress); $cellAddress = Functions::flattenSingleValue($cellAddress);
if (is_null($cellAddress) || $cellAddress === '') { if (is_null($cellAddress) || $cellAddress === '') {
@ -310,9 +310,9 @@ class LookupRef
list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
} }
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || if ((!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { ((!is_null($cellAddress2)) && (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { if (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
return Functions::REF(); return Functions::REF();
} }
@ -324,7 +324,7 @@ class LookupRef
$pSheet = $pCell->getWorksheet(); $pSheet = $pCell->getWorksheet();
} }
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false); return \PHPExcel\Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
} }
if (strpos($cellAddress, '!') !== false) { if (strpos($cellAddress, '!') !== false) {
@ -335,7 +335,7 @@ class LookupRef
$pSheet = $pCell->getWorksheet(); $pSheet = $pCell->getWorksheet();
} }
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false); return \PHPExcel\Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
} }
@ -390,23 +390,23 @@ class LookupRef
} else { } else {
$startCell = $endCell = $cellAddress; $startCell = $endCell = $cellAddress;
} }
list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell); list($startCellColumn, $startCellRow) = \PHPExcel\Cell::coordinateFromString($startCell);
list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell); list($endCellColumn, $endCellRow) = \PHPExcel\Cell::coordinateFromString($endCell);
$startCellRow += $rows; $startCellRow += $rows;
$startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1; $startCellColumn = \PHPExcel\Cell::columnIndexFromString($startCellColumn) - 1;
$startCellColumn += $columns; $startCellColumn += $columns;
if (($startCellRow <= 0) || ($startCellColumn < 0)) { if (($startCellRow <= 0) || ($startCellColumn < 0)) {
return Functions::REF(); return Functions::REF();
} }
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1; $endCellColumn = \PHPExcel\Cell::columnIndexFromString($endCellColumn) - 1;
if (($width != null) && (!is_object($width))) { if (($width != null) && (!is_object($width))) {
$endCellColumn = $startCellColumn + $width - 1; $endCellColumn = $startCellColumn + $width - 1;
} else { } else {
$endCellColumn += $columns; $endCellColumn += $columns;
} }
$startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn); $startCellColumn = \PHPExcel\Cell::stringFromColumnIndex($startCellColumn);
if (($height != null) && (!is_object($height))) { if (($height != null) && (!is_object($height))) {
$endCellRow = $startCellRow + $height - 1; $endCellRow = $startCellRow + $height - 1;
@ -417,7 +417,7 @@ class LookupRef
if (($endCellRow <= 0) || ($endCellColumn < 0)) { if (($endCellRow <= 0) || ($endCellColumn < 0)) {
return Functions::REF(); return Functions::REF();
} }
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn); $endCellColumn = \PHPExcel\Cell::stringFromColumnIndex($endCellColumn);
$cellAddress = $startCellColumn.$startCellRow; $cellAddress = $startCellColumn.$startCellRow;
if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
@ -430,7 +430,7 @@ class LookupRef
$pSheet = $pCell->getWorksheet(); $pSheet = $pCell->getWorksheet();
} }
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false); return \PHPExcel\Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
} }

View File

@ -22,10 +22,10 @@ namespace PHPExcel\Calculation;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Calculation * @package PHPExcel_Calculation
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @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 MathTrig class MathTrig
{ {
@ -556,9 +556,9 @@ class MathTrig
} }
try { try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); $matrix = new \PHPExcel\Shared\JAMA\Matrix($matrixData);
return $matrix->det(); return $matrix->det();
} catch (PHPExcel_Exception $ex) { } catch (\PHPExcel\Exception $ex) {
return Functions::VALUE(); return Functions::VALUE();
} }
} }
@ -607,9 +607,9 @@ class MathTrig
} }
try { try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); $matrix = new \PHPExcel\Shared\JAMA\Matrix($matrixData);
return $matrix->inverse()->getArray(); return $matrix->inverse()->getArray();
} catch (PHPExcel_Exception $ex) { } catch (\PHPExcel\Exception $ex) {
return Functions::VALUE(); return Functions::VALUE();
} }
} }
@ -648,7 +648,7 @@ class MathTrig
} }
++$rowA; ++$rowA;
} }
$matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData); $matrixA = new \PHPExcel\Shared\JAMA\Matrix($matrixAData);
$rowB = 0; $rowB = 0;
foreach ($matrixData2 as $matrixRow) { foreach ($matrixData2 as $matrixRow) {
if (!is_array($matrixRow)) { if (!is_array($matrixRow)) {
@ -664,14 +664,14 @@ class MathTrig
} }
++$rowB; ++$rowB;
} }
$matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData); $matrixB = new \PHPExcel\Shared\JAMA\Matrix($matrixBData);
if ($columnA != $rowB) { if ($columnA != $rowB) {
return Functions::VALUE(); return Functions::VALUE();
} }
return $matrixA->times($matrixB)->getArray(); return $matrixA->times($matrixB)->getArray();
} catch (PHPExcel_Exception $ex) { } catch (\PHPExcel\Exception $ex) {
var_dump($ex->getMessage()); var_dump($ex->getMessage());
return Functions::VALUE(); return Functions::VALUE();
} }
@ -1199,11 +1199,11 @@ class MathTrig
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = str_replace('"', '""', $arg); $arg = str_replace('"', '""', $arg);
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
// Is it a value within our criteria // Is it a value within our criteria
$returnValue += $sumArgs[$key]; $returnValue += $sumArgs[$key];
} }

View File

@ -37,10 +37,10 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Calculation * @package PHPExcel_Calculation
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @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 Statistical class Statistical
{ {
@ -869,10 +869,10 @@ class Statistical
$aCount = 0; $aCount = 0;
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
if ((is_null($returnValue)) || ($arg > $returnValue)) { if ((is_null($returnValue)) || ($arg > $returnValue)) {
$returnValue += $arg; $returnValue += $arg;
++$aCount; ++$aCount;
@ -1290,10 +1290,10 @@ class Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $arg) { foreach ($aArgs as $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
// Is it a value within our criteria // Is it a value within our criteria
++$returnValue; ++$returnValue;
} }
@ -2282,10 +2282,10 @@ class Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
if ((is_null($returnValue)) || ($arg > $returnValue)) { if ((is_null($returnValue)) || ($arg > $returnValue)) {
$returnValue = $arg; $returnValue = $arg;
} }
@ -2441,10 +2441,10 @@ class Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
if ((is_null($returnValue)) || ($arg < $returnValue)) { if ((is_null($returnValue)) || ($arg < $returnValue)) {
$returnValue = $arg; $returnValue = $arg;
} }

View File

@ -85,7 +85,7 @@ class TextData
$stringValue = Functions::flattenSingleValue($stringValue); $stringValue = Functions::flattenSingleValue($stringValue);
if (is_bool($stringValue)) { if (is_bool($stringValue)) {
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); return ($stringValue) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (self::$invalidChars == null) { if (self::$invalidChars == null) {
@ -109,7 +109,7 @@ class TextData
{ {
$stringValue = Functions::flattenSingleValue($stringValue); $stringValue = Functions::flattenSingleValue($stringValue);
if (is_bool($stringValue)) { if (is_bool($stringValue)) {
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); return ($stringValue) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (is_string($stringValue) || is_numeric($stringValue)) { if (is_string($stringValue) || is_numeric($stringValue)) {
@ -135,7 +135,7 @@ class TextData
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$characters = (int) $characters; $characters = (int) $characters;
} else { } else {
$characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $characters = ($characters) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
} }
@ -170,7 +170,7 @@ class TextData
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$arg = (int) $arg; $arg = (int) $arg;
} else { } else {
$arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $arg = ($arg) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
} }
$returnValue .= $arg; $returnValue .= $arg;
@ -214,7 +214,7 @@ class TextData
$value = MathTrig::MROUND($value, $round); $value = MathTrig::MROUND($value, $round);
} }
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask); return \PHPExcel\Style\NumberFormat::toFormattedString($value, $mask);
} }
@ -235,11 +235,11 @@ class TextData
if (!is_bool($needle)) { if (!is_bool($needle)) {
if (is_bool($haystack)) { if (is_bool($haystack)) {
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) {
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) {
return $offset; return $offset;
} }
if (function_exists('mb_strpos')) { if (function_exists('mb_strpos')) {
@ -272,11 +272,11 @@ class TextData
if (!is_bool($needle)) { if (!is_bool($needle)) {
if (is_bool($haystack)) { if (is_bool($haystack)) {
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) {
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) {
return $offset; return $offset;
} }
if (function_exists('mb_stripos')) { if (function_exists('mb_stripos')) {
@ -342,7 +342,7 @@ class TextData
} }
if (is_bool($value)) { if (is_bool($value)) {
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $value = ($value) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (function_exists('mb_substr')) { if (function_exists('mb_substr')) {
@ -372,7 +372,7 @@ class TextData
} }
if (is_bool($value)) { if (is_bool($value)) {
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $value = ($value) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (function_exists('mb_substr')) { if (function_exists('mb_substr')) {
@ -400,7 +400,7 @@ class TextData
} }
if (is_bool($value)) { if (is_bool($value)) {
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $value = ($value) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) { if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
@ -422,7 +422,7 @@ class TextData
$value = Functions::flattenSingleValue($value); $value = Functions::flattenSingleValue($value);
if (is_bool($value)) { if (is_bool($value)) {
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $value = ($value) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (function_exists('mb_strlen')) { if (function_exists('mb_strlen')) {
@ -446,10 +446,10 @@ class TextData
$mixedCaseString = Functions::flattenSingleValue($mixedCaseString); $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) { if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return PHPExcel_Shared_String::StrToLower($mixedCaseString); return \PHPExcel\Shared\String::StrToLower($mixedCaseString);
} }
@ -466,10 +466,10 @@ class TextData
$mixedCaseString = Functions::flattenSingleValue($mixedCaseString); $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) { if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return PHPExcel_Shared_String::StrToUpper($mixedCaseString); return \PHPExcel\Shared\String::StrToUpper($mixedCaseString);
} }
@ -486,10 +486,10 @@ class TextData
$mixedCaseString = Functions::flattenSingleValue($mixedCaseString); $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) { if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return PHPExcel_Shared_String::StrToTitle($mixedCaseString); return \PHPExcel\Shared\String::StrToTitle($mixedCaseString);
} }
@ -593,11 +593,11 @@ class TextData
$value = Functions::flattenSingleValue($value); $value = Functions::flattenSingleValue($value);
$format = Functions::flattenSingleValue($format); $format = Functions::flattenSingleValue($format);
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) { if ((is_string($value)) && (!is_numeric($value)) && PHPExcel\Shared\Date::isDateTimeFormatCode($format)) {
$value = DateTime::DATEVALUE($value); $value = DateTime::DATEVALUE($value);
} }
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format); return (string) \PHPExcel\Style\NumberFormat::toFormattedString($value, $format);
} }
/** /**
@ -612,9 +612,9 @@ class TextData
if (!is_numeric($value)) { if (!is_numeric($value)) {
$numberValue = str_replace( $numberValue = str_replace(
PHPExcel_Shared_String::getThousandsSeparator(), \PHPExcel\Shared\String::getThousandsSeparator(),
'', '',
trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode()) trim($value, " \t\n\r\0\x0B" . \PHPExcel\Shared\String::getCurrencyCode())
); );
if (is_numeric($numberValue)) { if (is_numeric($numberValue)) {
return (float) $numberValue; return (float) $numberValue;

View File

@ -68,7 +68,7 @@ class Stack
'reference' => $reference 'reference' => $reference
); );
if ($type == 'Function') { if ($type == 'Function') {
$localeFunction = PHPExcel_Calculation::localeFunc($value); $localeFunction = \PHPExcel\Calculation::localeFunc($value);
if ($localeFunction != $value) { if ($localeFunction != $value) {
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction; $this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
} }