namespacing in calculation functions
This commit is contained in:
parent
ee04f30d67
commit
621fc9aec7
|
@ -91,7 +91,7 @@ class DateTime
|
|||
(Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
|
||||
$dateValue = \PHPExcel\Shared\Date::PHPToExcel($dateValue);
|
||||
} else {
|
||||
$saveReturnDateType = Functions::getReturnDateType();
|
||||
|
@ -179,7 +179,7 @@ class DateTime
|
|||
$retValue = (integer) time();
|
||||
break;
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
$retValue = new DateTime();
|
||||
$retValue = new \DateTime();
|
||||
break;
|
||||
}
|
||||
date_default_timezone_set($saveTimeZone);
|
||||
|
@ -448,7 +448,7 @@ class DateTime
|
|||
$dayAdjust = floor($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) {
|
||||
$phpDateObject->modify($dayAdjust.' days');
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ class DateTime
|
|||
$PHPDateArray['day'] = strftime('%d');
|
||||
}
|
||||
$excelDateValue = floor(
|
||||
PHPExcel_Shared_Date::FormattedPHPToExcel(
|
||||
\PHPExcel\Shared\Date::FormattedPHPToExcel(
|
||||
$PHPDateArray['year'],
|
||||
$PHPDateArray['month'],
|
||||
$PHPDateArray['day'],
|
||||
|
@ -573,9 +573,9 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $excelDateValue;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue);
|
||||
return (integer) \PHPExcel\Shared\Date::ExcelToPHP($excelDateValue);
|
||||
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();
|
||||
|
@ -612,7 +612,7 @@ class DateTime
|
|||
$PHPDateArray = date_parse($timeValue);
|
||||
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
|
||||
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(
|
||||
$excelDateValue = \PHPExcel\Shared\Date::FormattedPHPToExcel(
|
||||
$PHPDateArray['year'],
|
||||
$PHPDateArray['month'],
|
||||
$PHPDateArray['day'],
|
||||
|
@ -621,16 +621,16 @@ class DateTime
|
|||
$PHPDateArray['second']
|
||||
);
|
||||
} 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()) {
|
||||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $excelDateValue;
|
||||
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:
|
||||
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();
|
||||
|
@ -668,12 +668,12 @@ class DateTime
|
|||
// Execute function
|
||||
$difference = $endDate - $startDate;
|
||||
|
||||
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
||||
$PHPStartDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($startDate);
|
||||
$startDays = $PHPStartDateObject->format('j');
|
||||
$startMonths = $PHPStartDateObject->format('n');
|
||||
$startYears = $PHPStartDateObject->format('Y');
|
||||
|
||||
$PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
|
||||
$PHPEndDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($endDate);
|
||||
$endDays = $PHPEndDateObject->format('j');
|
||||
$endMonths = $PHPEndDateObject->format('n');
|
||||
$endYears = $PHPEndDateObject->format('Y');
|
||||
|
@ -787,12 +787,12 @@ class DateTime
|
|||
}
|
||||
|
||||
// Execute function
|
||||
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
||||
$PHPStartDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($startDate);
|
||||
$startDay = $PHPStartDateObject->format('j');
|
||||
$startMonth = $PHPStartDateObject->format('n');
|
||||
$startYear = $PHPStartDateObject->format('Y');
|
||||
|
||||
$PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
|
||||
$PHPEndDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($endDate);
|
||||
$endDay = $PHPEndDateObject->format('j');
|
||||
$endMonth = $PHPEndDateObject->format('n');
|
||||
$endYear = $PHPEndDateObject->format('Y');
|
||||
|
@ -1094,9 +1094,9 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $endDate;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate);
|
||||
return (integer) \PHPExcel\Shared\Date::ExcelToPHP($endDate);
|
||||
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
|
||||
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
|
||||
$PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
|
||||
|
||||
return (int) $PHPDateObject->format('j');
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ class DateTime
|
|||
}
|
||||
|
||||
// Execute function
|
||||
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
|
||||
$PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
|
||||
$DoW = $PHPDateObject->format('w');
|
||||
|
||||
$firstDay = 1;
|
||||
|
@ -1249,7 +1249,7 @@ class DateTime
|
|||
}
|
||||
|
||||
// Execute function
|
||||
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
|
||||
$PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
|
||||
$dayOfYear = $PHPDateObject->format('z');
|
||||
$dow = $PHPDateObject->format('w');
|
||||
$PHPDateObject->modify('-' . $dayOfYear . ' days');
|
||||
|
@ -1288,7 +1288,7 @@ class DateTime
|
|||
}
|
||||
|
||||
// Execute function
|
||||
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
|
||||
$PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
|
||||
|
||||
return (int) $PHPDateObject->format('n');
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ class DateTime
|
|||
}
|
||||
|
||||
// Execute function
|
||||
$PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
|
||||
$PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue);
|
||||
|
||||
return (int) $PHPDateObject->format('Y');
|
||||
}
|
||||
|
@ -1361,7 +1361,7 @@ class DateTime
|
|||
} elseif ($timeValue < 0.0) {
|
||||
return Functions::NaN();
|
||||
}
|
||||
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
|
||||
$timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
|
||||
|
||||
return (int) gmdate('G', $timeValue);
|
||||
}
|
||||
|
@ -1402,7 +1402,7 @@ class DateTime
|
|||
} elseif ($timeValue < 0.0) {
|
||||
return Functions::NaN();
|
||||
}
|
||||
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
|
||||
$timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
|
||||
|
||||
return (int) gmdate('i', $timeValue);
|
||||
}
|
||||
|
@ -1443,7 +1443,7 @@ class DateTime
|
|||
} elseif ($timeValue < 0.0) {
|
||||
return Functions::NaN();
|
||||
}
|
||||
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
|
||||
$timeValue = \PHPExcel\Shared\Date::ExcelToPHP($timeValue);
|
||||
|
||||
return (int) gmdate('s', $timeValue);
|
||||
}
|
||||
|
@ -1487,9 +1487,9 @@ class DateTime
|
|||
|
||||
switch (Functions::getReturnDateType()) {
|
||||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
|
||||
return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject);
|
||||
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:
|
||||
return $PHPDateObject;
|
||||
}
|
||||
|
@ -1536,9 +1536,9 @@ class DateTime
|
|||
|
||||
switch (Functions::getReturnDateType()) {
|
||||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
|
||||
return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject);
|
||||
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:
|
||||
return $PHPDateObject;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class ExceptionHandler
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
|
||||
set_error_handler(array('\\PHPExcel\\Calculation\\Exception', 'errorHandlerCallback'), E_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,10 +67,10 @@ class Financial
|
|||
{
|
||||
$months = 12 / $frequency;
|
||||
|
||||
$result = PHPExcel_Shared_Date::ExcelToPHPObject($maturity);
|
||||
$result = \PHPExcel\Shared\Date::ExcelToPHPObject($maturity);
|
||||
$eom = self::isLastDayOfMonth($result);
|
||||
|
||||
while ($settlement < PHPExcel_Shared_Date::PHPToExcel($result)) {
|
||||
while ($settlement < \PHPExcel\Shared\Date::PHPToExcel($result)) {
|
||||
$result->modify('-'.$months.' months');
|
||||
}
|
||||
if ($next) {
|
||||
|
@ -81,7 +81,7 @@ class Financial
|
|||
$result->modify('-1 day');
|
||||
}
|
||||
|
||||
return PHPExcel_Shared_Date::PHPToExcel($result);
|
||||
return \PHPExcel\Shared\Date::PHPToExcel($result);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,21 +79,21 @@ class FormulaParser
|
|||
/**
|
||||
* Tokens
|
||||
*
|
||||
* @var PHPExcel_Calculation_FormulaToken[]
|
||||
* @var FormulaToken[]
|
||||
*/
|
||||
private $tokens = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Calculation_FormulaParser
|
||||
* Create a new FormulaParser
|
||||
*
|
||||
* @param string $pFormula Formula to parse
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pFormula = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (is_null($pFormula)) {
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
|
||||
throw new Exception("Invalid parameter passed: formula");
|
||||
}
|
||||
|
||||
// Initialise values
|
||||
|
@ -117,14 +117,14 @@ class FormulaParser
|
|||
*
|
||||
* @param int $pId Token id
|
||||
* @return string
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getToken($pId = 0)
|
||||
{
|
||||
if (isset($this->tokens[$pId])) {
|
||||
return $this->tokens[$pId];
|
||||
} 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
|
||||
*
|
||||
* @return PHPExcel_Calculation_FormulaToken[]
|
||||
* @return FormulaToken[]
|
||||
*/
|
||||
public function getTokens()
|
||||
{
|
||||
|
@ -180,13 +180,13 @@ class FormulaParser
|
|||
// embeds are doubled
|
||||
// end marks token
|
||||
if ($inString) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
|
||||
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
|
||||
if ($this->formula{$index} == self::QUOTE_DOUBLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_DOUBLE)) {
|
||||
$value .= self::QUOTE_DOUBLE;
|
||||
++$index;
|
||||
} else {
|
||||
$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 = "";
|
||||
}
|
||||
} else {
|
||||
|
@ -200,9 +200,9 @@ class FormulaParser
|
|||
// embeds are double
|
||||
// end does not mark a token
|
||||
if ($inPath) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
|
||||
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
|
||||
if ($this->formula{$index} == self::QUOTE_SINGLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_SINGLE)) {
|
||||
$value .= self::QUOTE_SINGLE;
|
||||
++$index;
|
||||
} else {
|
||||
$inPath = false;
|
||||
|
@ -218,7 +218,7 @@ class FormulaParser
|
|||
// no embeds (changed to "()" by Excel)
|
||||
// end does not mark a token
|
||||
if ($inRange) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
|
||||
if ($this->formula{$index} == self::BRACKET_CLOSE) {
|
||||
$inRange = false;
|
||||
}
|
||||
$value .= $this->formula{$index};
|
||||
|
@ -233,14 +233,14 @@ class FormulaParser
|
|||
++$index;
|
||||
if (in_array($value, $ERRORS)) {
|
||||
$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 = "";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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 (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
|
||||
$value .= $this->formula{$index};
|
||||
|
@ -253,10 +253,10 @@ class FormulaParser
|
|||
// independent character evaluation (order not important)
|
||||
|
||||
// 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)) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inString = true;
|
||||
|
@ -264,10 +264,10 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||
if ($this->formula{$index} == self::QUOTE_SINGLE) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inPath = true;
|
||||
|
@ -275,38 +275,38 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
|
||||
if ($this->formula{$index} == self::BRACKET_OPEN) {
|
||||
$inRange = true;
|
||||
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
|
||||
$value .= self::BRACKET_OPEN;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
|
||||
if ($this->formula{$index} == self::ERROR_START) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inError = true;
|
||||
$value .= PHPExcel_Calculation_FormulaParser::ERROR_START;
|
||||
$value .= self::ERROR_START;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$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;
|
||||
$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;
|
||||
$stack[] = clone $tmp;
|
||||
|
||||
|
@ -314,21 +314,21 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
|
||||
if ($this->formula{$index} == self::SEMICOLON) {
|
||||
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 = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
$tmp = new FormulaToken(",", FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
$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;
|
||||
$stack[] = clone $tmp;
|
||||
|
||||
|
@ -336,20 +336,20 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
|
||||
if ($this->formula{$index} == self::BRACE_CLOSE) {
|
||||
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 = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
++$index;
|
||||
|
@ -357,14 +357,14 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// trim white-space
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
|
||||
if ($this->formula{$index} == self::WHITESPACE) {
|
||||
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 = "";
|
||||
}
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
|
||||
$tokens1[] = new FormulaToken("", FormulaToken::TOKEN_TYPE_WHITESPACE);
|
||||
++$index;
|
||||
while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
|
||||
while (($this->formula{$index} == self::WHITESPACE) && ($index < $formulaLength)) {
|
||||
++$index;
|
||||
}
|
||||
continue;
|
||||
|
@ -374,46 +374,46 @@ class FormulaParser
|
|||
if (($index + 2) <= $formulaLength) {
|
||||
if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) {
|
||||
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 = "";
|
||||
}
|
||||
$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;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$tokens1[] =new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$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;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$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;
|
||||
continue;
|
||||
}
|
||||
|
||||
// start subexpression or function
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
|
||||
if ($this->formula{$index} == self::PAREN_OPEN) {
|
||||
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;
|
||||
$stack[] = clone $tmp;
|
||||
$value = "";
|
||||
} 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;
|
||||
$stack[] = clone $tmp;
|
||||
}
|
||||
|
@ -422,36 +422,36 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$stack[] = $tmp;
|
||||
|
||||
if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION);
|
||||
if ($tmp->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
$tokens1[] = new FormulaToken(",", FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_UNION);
|
||||
} else {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
$tokens1[] = new FormulaToken(",", FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// stop subexpression
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
|
||||
if ($this->formula{$index} == self::PAREN_CLOSE) {
|
||||
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 = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
++$index;
|
||||
|
@ -465,7 +465,7 @@ class FormulaParser
|
|||
|
||||
// dump remaining accumulation
|
||||
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
|
||||
|
@ -487,7 +487,7 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) {
|
||||
if ($token->getTokenType() != FormulaToken::TOKEN_TYPE_WHITESPACE) {
|
||||
$tokens2[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
@ -497,9 +497,9 @@ class FormulaParser
|
|||
}
|
||||
|
||||
if (! (
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -509,14 +509,14 @@ class FormulaParser
|
|||
}
|
||||
|
||||
if (! (
|
||||
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
(($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
(($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
) ) {
|
||||
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
|
||||
|
@ -541,34 +541,34 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
|
||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
|
||||
if ($i == 0) {
|
||||
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
$token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
} elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
} else {
|
||||
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
$token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
|
||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
|
||||
if ($i == 0) {
|
||||
continue;
|
||||
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
} elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -577,37 +577,37 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
|
||||
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
|
||||
$token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
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() == "&") {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND &&
|
||||
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND &&
|
||||
$token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
if (!is_numeric($token->getValue())) {
|
||||
if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE);
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_RANGE);
|
||||
}
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER);
|
||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_NUMBER);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
if (strlen($token->getValue() > 0)) {
|
||||
if (substr($token->getValue(), 0, 1) == "@") {
|
||||
$token->setValue(substr($token->getValue(), 1));
|
||||
|
|
|
@ -100,13 +100,13 @@ class FormulaToken
|
|||
private $tokenSubType;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Calculation_FormulaToken
|
||||
* Create a new FormulaToken
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
||||
* @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
|
||||
$this->value = $pValue;
|
||||
|
@ -149,7 +149,7 @@ class FormulaToken
|
|||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN)
|
||||
public function setTokenType($value = self::TOKEN_TYPE_UNKNOWN)
|
||||
{
|
||||
$this->tokenType = $value;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class FormulaToken
|
|||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
||||
public function setTokenSubType($value = self::TOKEN_SUBTYPE_NOTHING)
|
||||
{
|
||||
$this->tokenSubType = $value;
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ class Functions
|
|||
}
|
||||
if (!in_array($condition{0}, array('>', '<', '='))) {
|
||||
if (!is_numeric($condition)) {
|
||||
$condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
|
||||
$condition = \PHPExcel\Calculation::wrapResult(strtoupper($condition));
|
||||
}
|
||||
return '=' . $condition;
|
||||
} else {
|
||||
|
@ -323,7 +323,7 @@ class Functions
|
|||
|
||||
if (!is_numeric($operand)) {
|
||||
$operand = str_replace('"', '""', $operand);
|
||||
$operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
|
||||
$operand = \PHPExcel\Calculation::wrapResult(strtoupper($operand));
|
||||
}
|
||||
|
||||
return $operator.$operand;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace PHPExcel\Calculation;
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Logical
|
||||
class Logical
|
||||
{
|
||||
/**
|
||||
* TRUE
|
||||
|
@ -102,9 +102,9 @@ class PHPExcel_Calculation_Logical
|
|||
$returnValue = $returnValue && ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
if (($arg == 'TRUE') || ($arg == \PHPExcel\Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
} elseif (($arg == 'FALSE') || ($arg == \PHPExcel\Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return Functions::VALUE();
|
||||
|
@ -158,9 +158,9 @@ class PHPExcel_Calculation_Logical
|
|||
$returnValue = $returnValue || ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
if (($arg == 'TRUE') || ($arg == \PHPExcel\Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
} elseif (($arg == 'FALSE') || ($arg == \PHPExcel\Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return Functions::VALUE();
|
||||
|
@ -202,9 +202,9 @@ class PHPExcel_Calculation_Logical
|
|||
$logical = Functions::flattenSingleValue($logical);
|
||||
if (is_string($logical)) {
|
||||
$logical = strtoupper($logical);
|
||||
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
||||
if (($logical == 'TRUE') || ($logical == \PHPExcel\Calculation::getTRUE())) {
|
||||
return false;
|
||||
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
||||
} elseif (($logical == 'FALSE') || ($logical == \PHPExcel\Calculation::getFALSE())) {
|
||||
return true;
|
||||
} else {
|
||||
return Functions::VALUE();
|
||||
|
|
|
@ -69,7 +69,7 @@ class LookupRef
|
|||
}
|
||||
if ((!is_bool($referenceStyle)) || $referenceStyle) {
|
||||
$rowRelative = $columnRelative = '$';
|
||||
$column = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
$column = \PHPExcel\Cell::stringFromColumnIndex($column-1);
|
||||
if (($relativity == 2) || ($relativity == 4)) {
|
||||
$columnRelative = '';
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class LookupRef
|
|||
if (is_array($cellAddress)) {
|
||||
foreach ($cellAddress as $columnKey => $value) {
|
||||
$columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
|
||||
return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
|
||||
return (integer) \PHPExcel\Cell::columnIndexFromString($columnKey);
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
|
@ -124,12 +124,12 @@ class LookupRef
|
|||
$endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
|
||||
$returnValue = array();
|
||||
do {
|
||||
$returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
|
||||
$returnValue[] = (integer) \PHPExcel\Cell::columnIndexFromString($startAddress);
|
||||
} while ($startAddress++ != $endAddress);
|
||||
return $returnValue;
|
||||
} else {
|
||||
$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);
|
||||
$isMatrix = (is_numeric(key($cellAddress)));
|
||||
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
list($columns, $rows) = \PHPExcel\Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $rows;
|
||||
|
@ -234,7 +234,7 @@ class LookupRef
|
|||
|
||||
reset($cellAddress);
|
||||
$isMatrix = (is_numeric(key($cellAddress)));
|
||||
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
list($columns, $rows) = \PHPExcel\Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $columns;
|
||||
|
@ -254,10 +254,10 @@ class LookupRef
|
|||
* @category Logical Functions
|
||||
* @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 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)
|
||||
*/
|
||||
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();
|
||||
$pCell = array_pop($args);
|
||||
|
@ -291,13 +291,13 @@ class LookupRef
|
|||
* 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 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
|
||||
*
|
||||
* @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);
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
|
@ -310,9 +310,9 @@ class LookupRef
|
|||
list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
|
||||
}
|
||||
|
||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $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_CELLREF.'$/i', $cellAddress1, $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)) {
|
||||
return Functions::REF();
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ class LookupRef
|
|||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
|
||||
return \PHPExcel\Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
|
||||
}
|
||||
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
|
@ -335,7 +335,7 @@ class LookupRef
|
|||
$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 {
|
||||
$startCell = $endCell = $cellAddress;
|
||||
}
|
||||
list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
|
||||
list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
|
||||
list($startCellColumn, $startCellRow) = \PHPExcel\Cell::coordinateFromString($startCell);
|
||||
list($endCellColumn, $endCellRow) = \PHPExcel\Cell::coordinateFromString($endCell);
|
||||
|
||||
$startCellRow += $rows;
|
||||
$startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
|
||||
$startCellColumn = \PHPExcel\Cell::columnIndexFromString($startCellColumn) - 1;
|
||||
$startCellColumn += $columns;
|
||||
|
||||
if (($startCellRow <= 0) || ($startCellColumn < 0)) {
|
||||
return Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
|
||||
$endCellColumn = \PHPExcel\Cell::columnIndexFromString($endCellColumn) - 1;
|
||||
if (($width != null) && (!is_object($width))) {
|
||||
$endCellColumn = $startCellColumn + $width - 1;
|
||||
} else {
|
||||
$endCellColumn += $columns;
|
||||
}
|
||||
$startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
|
||||
$startCellColumn = \PHPExcel\Cell::stringFromColumnIndex($startCellColumn);
|
||||
|
||||
if (($height != null) && (!is_object($height))) {
|
||||
$endCellRow = $startCellRow + $height - 1;
|
||||
|
@ -417,7 +417,7 @@ class LookupRef
|
|||
if (($endCellRow <= 0) || ($endCellColumn < 0)) {
|
||||
return Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
|
||||
$endCellColumn = \PHPExcel\Cell::stringFromColumnIndex($endCellColumn);
|
||||
|
||||
$cellAddress = $startCellColumn.$startCellRow;
|
||||
if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
|
||||
|
@ -430,7 +430,7 @@ class LookupRef
|
|||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
|
||||
return \PHPExcel\Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -556,9 +556,9 @@ class MathTrig
|
|||
}
|
||||
|
||||
try {
|
||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||
$matrix = new \PHPExcel\Shared\JAMA\Matrix($matrixData);
|
||||
return $matrix->det();
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
} catch (\PHPExcel\Exception $ex) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
}
|
||||
|
@ -607,9 +607,9 @@ class MathTrig
|
|||
}
|
||||
|
||||
try {
|
||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||
$matrix = new \PHPExcel\Shared\JAMA\Matrix($matrixData);
|
||||
return $matrix->inverse()->getArray();
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
} catch (\PHPExcel\Exception $ex) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ class MathTrig
|
|||
}
|
||||
++$rowA;
|
||||
}
|
||||
$matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
|
||||
$matrixA = new \PHPExcel\Shared\JAMA\Matrix($matrixAData);
|
||||
$rowB = 0;
|
||||
foreach ($matrixData2 as $matrixRow) {
|
||||
if (!is_array($matrixRow)) {
|
||||
|
@ -664,14 +664,14 @@ class MathTrig
|
|||
}
|
||||
++$rowB;
|
||||
}
|
||||
$matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
|
||||
$matrixB = new \PHPExcel\Shared\JAMA\Matrix($matrixBData);
|
||||
|
||||
if ($columnA != $rowB) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
return $matrixA->times($matrixB)->getArray();
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
} catch (\PHPExcel\Exception $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
@ -1199,11 +1199,11 @@ class MathTrig
|
|||
foreach ($aArgs as $key => $arg) {
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = str_replace('"', '""', $arg);
|
||||
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
|
||||
$arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
|
||||
}
|
||||
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
// Is it a value within our criteria
|
||||
$returnValue += $sumArgs[$key];
|
||||
}
|
||||
|
|
|
@ -869,10 +869,10 @@ class Statistical
|
|||
$aCount = 0;
|
||||
foreach ($aArgs as $key => $arg) {
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
|
||||
$arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
|
||||
}
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if ((is_null($returnValue)) || ($arg > $returnValue)) {
|
||||
$returnValue += $arg;
|
||||
++$aCount;
|
||||
|
@ -1290,10 +1290,10 @@ class Statistical
|
|||
// Loop through arguments
|
||||
foreach ($aArgs as $arg) {
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
|
||||
$arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
|
||||
}
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
// Is it a value within our criteria
|
||||
++$returnValue;
|
||||
}
|
||||
|
@ -2282,10 +2282,10 @@ class Statistical
|
|||
// Loop through arguments
|
||||
foreach ($aArgs as $key => $arg) {
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
|
||||
$arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
|
||||
}
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if ((is_null($returnValue)) || ($arg > $returnValue)) {
|
||||
$returnValue = $arg;
|
||||
}
|
||||
|
@ -2441,10 +2441,10 @@ class Statistical
|
|||
// Loop through arguments
|
||||
foreach ($aArgs as $key => $arg) {
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
|
||||
$arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg));
|
||||
}
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
if ((is_null($returnValue)) || ($arg < $returnValue)) {
|
||||
$returnValue = $arg;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class TextData
|
|||
$stringValue = Functions::flattenSingleValue($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) {
|
||||
|
@ -109,7 +109,7 @@ class TextData
|
|||
{
|
||||
$stringValue = Functions::flattenSingleValue($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)) {
|
||||
|
@ -135,7 +135,7 @@ class TextData
|
|||
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$characters = (int) $characters;
|
||||
} 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) {
|
||||
$arg = (int) $arg;
|
||||
} else {
|
||||
$arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
$arg = ($arg) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
}
|
||||
$returnValue .= $arg;
|
||||
|
@ -214,7 +214,7 @@ class TextData
|
|||
$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($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 (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||
if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_strpos')) {
|
||||
|
@ -272,11 +272,11 @@ class TextData
|
|||
|
||||
if (!is_bool($needle)) {
|
||||
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 (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||
if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_stripos')) {
|
||||
|
@ -342,7 +342,7 @@ class TextData
|
|||
}
|
||||
|
||||
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')) {
|
||||
|
@ -372,7 +372,7 @@ class TextData
|
|||
}
|
||||
|
||||
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')) {
|
||||
|
@ -400,7 +400,7 @@ class TextData
|
|||
}
|
||||
|
||||
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'))) {
|
||||
|
@ -422,7 +422,7 @@ class TextData
|
|||
$value = Functions::flattenSingleValue($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')) {
|
||||
|
@ -446,10 +446,10 @@ class TextData
|
|||
$mixedCaseString = Functions::flattenSingleValue($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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
$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);
|
||||
}
|
||||
|
||||
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)) {
|
||||
$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)) {
|
||||
return (float) $numberValue;
|
||||
|
|
|
@ -68,7 +68,7 @@ class Stack
|
|||
'reference' => $reference
|
||||
);
|
||||
if ($type == 'Function') {
|
||||
$localeFunction = PHPExcel_Calculation::localeFunc($value);
|
||||
$localeFunction = \PHPExcel\Calculation::localeFunc($value);
|
||||
if ($localeFunction != $value) {
|
||||
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue