Use correct declared debugLog
This commit is contained in:
parent
56245d558e
commit
8ce610eb59
|
@ -91,13 +91,6 @@ class Calculation
|
||||||
*/
|
*/
|
||||||
private $spreadsheet;
|
private $spreadsheet;
|
||||||
|
|
||||||
/**
|
|
||||||
* List of instances of the calculation engine that we've instantiated for individual spreadsheets.
|
|
||||||
*
|
|
||||||
* @var \PhpOffice\PhpSpreadsheet\Calculation[]
|
|
||||||
*/
|
|
||||||
private static $spreadsheetSets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculation cache.
|
* Calculation cache.
|
||||||
*
|
*
|
||||||
|
@ -2041,7 +2034,7 @@ class Calculation
|
||||||
|
|
||||||
$this->spreadsheet = $spreadsheet;
|
$this->spreadsheet = $spreadsheet;
|
||||||
$this->cyclicReferenceStack = new CalcEngine\CyclicReferenceStack();
|
$this->cyclicReferenceStack = new CalcEngine\CyclicReferenceStack();
|
||||||
$this->_debugLog = new CalcEngine\Logger($this->cyclicReferenceStack);
|
$this->debugLog = new CalcEngine\Logger($this->cyclicReferenceStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function loadLocales()
|
private static function loadLocales()
|
||||||
|
@ -2099,13 +2092,13 @@ class Calculation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the debuglog for this claculation engine instance.
|
* Get the Logger for this calculation engine instance.
|
||||||
*
|
*
|
||||||
* @return CalcEngine\Logger
|
* @return CalcEngine\Logger
|
||||||
*/
|
*/
|
||||||
public function getDebugLog()
|
public function getDebugLog()
|
||||||
{
|
{
|
||||||
return $this->_debugLog;
|
return $this->debugLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2553,7 +2546,7 @@ class Calculation
|
||||||
if ($resetLog) {
|
if ($resetLog) {
|
||||||
// Initialise the logging settings if requested
|
// Initialise the logging settings if requested
|
||||||
$this->formulaError = null;
|
$this->formulaError = null;
|
||||||
$this->_debugLog->clearLog();
|
$this->debugLog->clearLog();
|
||||||
$this->cyclicReferenceStack->clear();
|
$this->cyclicReferenceStack->clear();
|
||||||
$this->cyclicFormulaCounter = 1;
|
$this->cyclicFormulaCounter = 1;
|
||||||
|
|
||||||
|
@ -2651,7 +2644,7 @@ class Calculation
|
||||||
{
|
{
|
||||||
// Initialise the logging settings
|
// Initialise the logging settings
|
||||||
$this->formulaError = null;
|
$this->formulaError = null;
|
||||||
$this->_debugLog->clearLog();
|
$this->debugLog->clearLog();
|
||||||
$this->cyclicReferenceStack->clear();
|
$this->cyclicReferenceStack->clear();
|
||||||
|
|
||||||
if ($this->spreadsheet !== null && $cellID === null && $pCell === null) {
|
if ($this->spreadsheet !== null && $cellID === null && $pCell === null) {
|
||||||
|
@ -2683,9 +2676,9 @@ class Calculation
|
||||||
{
|
{
|
||||||
// Is calculation cacheing enabled?
|
// Is calculation cacheing enabled?
|
||||||
// Is the value present in calculation cache?
|
// Is the value present in calculation cache?
|
||||||
$this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
|
$this->debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
|
||||||
if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
|
if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
|
||||||
$this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
|
$this->debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
|
||||||
// Return the cached result
|
// Return the cached result
|
||||||
$cellValue = $this->calculationCache[$cellReference];
|
$cellValue = $this->calculationCache[$cellReference];
|
||||||
|
|
||||||
|
@ -2940,7 +2933,7 @@ class Calculation
|
||||||
*/
|
*/
|
||||||
private function showValue($value)
|
private function showValue($value)
|
||||||
{
|
{
|
||||||
if ($this->_debugLog->getWriteDebugLog()) {
|
if ($this->debugLog->getWriteDebugLog()) {
|
||||||
$testArray = Calculation\Functions::flattenArray($value);
|
$testArray = Calculation\Functions::flattenArray($value);
|
||||||
if (count($testArray) == 1) {
|
if (count($testArray) == 1) {
|
||||||
$value = array_pop($testArray);
|
$value = array_pop($testArray);
|
||||||
|
@ -2978,7 +2971,7 @@ class Calculation
|
||||||
*/
|
*/
|
||||||
private function showTypeDetails($value)
|
private function showTypeDetails($value)
|
||||||
{
|
{
|
||||||
if ($this->_debugLog->getWriteDebugLog()) {
|
if ($this->debugLog->getWriteDebugLog()) {
|
||||||
$testArray = Calculation\Functions::flattenArray($value);
|
$testArray = Calculation\Functions::flattenArray($value);
|
||||||
if (count($testArray) == 1) {
|
if (count($testArray) == 1) {
|
||||||
$value = array_pop($testArray);
|
$value = array_pop($testArray);
|
||||||
|
@ -3456,9 +3449,9 @@ class Calculation
|
||||||
|
|
||||||
// Log what we're doing
|
// Log what we're doing
|
||||||
if ($token == ':') {
|
if ($token == ':') {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference']));
|
$this->debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference']));
|
||||||
} else {
|
} else {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2));
|
$this->debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the operation in the appropriate manner
|
// Process the operation in the appropriate manner
|
||||||
|
@ -3558,13 +3551,13 @@ class Calculation
|
||||||
$matrixResult = $matrix->concat($operand2);
|
$matrixResult = $matrix->concat($operand2);
|
||||||
$result = $matrixResult->getArray();
|
$result = $matrixResult->getArray();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
||||||
$result = '#VALUE!';
|
$result = '#VALUE!';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = '"' . str_replace('""', '"', self::unwrapResult($operand1) . self::unwrapResult($operand2)) . '"';
|
$result = '"' . str_replace('""', '"', self::unwrapResult($operand1) . self::unwrapResult($operand2)) . '"';
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
||||||
$stack->push('Value', $result);
|
$stack->push('Value', $result);
|
||||||
break;
|
break;
|
||||||
case '|': // Intersect
|
case '|': // Intersect
|
||||||
|
@ -3578,7 +3571,7 @@ class Calculation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow);
|
$cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow);
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect));
|
||||||
$stack->push('Value', $cellIntersect, $cellRef);
|
$stack->push('Value', $cellIntersect, $cellRef);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3590,10 +3583,10 @@ class Calculation
|
||||||
}
|
}
|
||||||
$arg = $arg['value'];
|
$arg = $arg['value'];
|
||||||
if ($token === '~') {
|
if ($token === '~') {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg));
|
$this->debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg));
|
||||||
$multiplier = -1;
|
$multiplier = -1;
|
||||||
} else {
|
} else {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg));
|
$this->debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg));
|
||||||
$multiplier = 0.01;
|
$multiplier = 0.01;
|
||||||
}
|
}
|
||||||
if (is_array($arg)) {
|
if (is_array($arg)) {
|
||||||
|
@ -3603,10 +3596,10 @@ class Calculation
|
||||||
$matrixResult = $matrix1->arrayTimesEquals($multiplier);
|
$matrixResult = $matrix1->arrayTimesEquals($multiplier);
|
||||||
$result = $matrixResult->getArray();
|
$result = $matrixResult->getArray();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
||||||
$result = '#VALUE!';
|
$result = '#VALUE!';
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
||||||
$stack->push('Value', $result);
|
$stack->push('Value', $result);
|
||||||
} else {
|
} else {
|
||||||
$this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
|
$this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
|
||||||
|
@ -3626,21 +3619,21 @@ class Calculation
|
||||||
return $this->raiseFormulaError('Unable to access External Workbook');
|
return $this->raiseFormulaError('Unable to access External Workbook');
|
||||||
}
|
}
|
||||||
$matches[2] = trim($matches[2], "\"'");
|
$matches[2] = trim($matches[2], "\"'");
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
|
$this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false);
|
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false);
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError('Unable to access Cell Reference');
|
return $this->raiseFormulaError('Unable to access Cell Reference');
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
|
$this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
|
||||||
} else {
|
} else {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
|
$this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError('Unable to access Cell Reference');
|
return $this->raiseFormulaError('Unable to access Cell Reference');
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
|
$this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3655,7 +3648,7 @@ class Calculation
|
||||||
// It's a Reference to an external spreadsheet (not currently supported)
|
// It's a Reference to an external spreadsheet (not currently supported)
|
||||||
return $this->raiseFormulaError('Unable to access External Workbook');
|
return $this->raiseFormulaError('Unable to access External Workbook');
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
|
$this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellSheet = $this->spreadsheet->getSheetByName($matches[2]);
|
$cellSheet = $this->spreadsheet->getSheetByName($matches[2]);
|
||||||
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
|
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
|
||||||
|
@ -3667,16 +3660,16 @@ class Calculation
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError('Unable to access Cell Reference');
|
return $this->raiseFormulaError('Unable to access Cell Reference');
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
|
$this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
|
||||||
} else {
|
} else {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
|
$this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
|
||||||
if ($pCellParent->isDataSet($cellRef)) {
|
if ($pCellParent->isDataSet($cellRef)) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
|
||||||
$pCell->attach($pCellParent);
|
$pCell->attach($pCellParent);
|
||||||
} else {
|
} else {
|
||||||
$cellValue = null;
|
$cellValue = null;
|
||||||
}
|
}
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
|
$this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3688,7 +3681,7 @@ class Calculation
|
||||||
$argCount = $stack->pop();
|
$argCount = $stack->pop();
|
||||||
$argCount = $argCount['value'];
|
$argCount = $argCount['value'];
|
||||||
if ($functionName != 'MKMATRIX') {
|
if ($functionName != 'MKMATRIX') {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
|
$this->debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
|
||||||
}
|
}
|
||||||
if ((isset(self::$phpSpreadsheetFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function
|
if ((isset(self::$phpSpreadsheetFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function
|
||||||
if (isset(self::$phpSpreadsheetFunctions[$functionName])) {
|
if (isset(self::$phpSpreadsheetFunctions[$functionName])) {
|
||||||
|
@ -3734,9 +3727,9 @@ class Calculation
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($functionName != 'MKMATRIX') {
|
if ($functionName != 'MKMATRIX') {
|
||||||
if ($this->_debugLog->getWriteDebugLog()) {
|
if ($this->debugLog->getWriteDebugLog()) {
|
||||||
krsort($argArrayVals);
|
krsort($argArrayVals);
|
||||||
$this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )');
|
$this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3755,7 +3748,7 @@ class Calculation
|
||||||
$result = call_user_func_array($functionCall, $args);
|
$result = call_user_func_array($functionCall, $args);
|
||||||
|
|
||||||
if ($functionName != 'MKMATRIX') {
|
if ($functionName != 'MKMATRIX') {
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result));
|
||||||
}
|
}
|
||||||
$stack->push('Value', self::wrapResult($result));
|
$stack->push('Value', self::wrapResult($result));
|
||||||
}
|
}
|
||||||
|
@ -3764,16 +3757,16 @@ class Calculation
|
||||||
if (isset(self::$excelConstants[strtoupper($token)])) {
|
if (isset(self::$excelConstants[strtoupper($token)])) {
|
||||||
$excelConstant = strtoupper($token);
|
$excelConstant = strtoupper($token);
|
||||||
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
|
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
|
$this->debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
|
||||||
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) {
|
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) {
|
||||||
$stack->push('Value', $token);
|
$stack->push('Value', $token);
|
||||||
// if the token is a named range, push the named range name onto the stack
|
// if the token is a named range, push the named range name onto the stack
|
||||||
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) {
|
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) {
|
||||||
$namedRange = $matches[6];
|
$namedRange = $matches[6];
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
|
$this->debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
|
||||||
$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
|
$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
|
||||||
$pCell->attach($pCellParent);
|
$pCell->attach($pCellParent);
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));
|
$this->debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));
|
||||||
$stack->push('Named Range', $cellValue, $namedRange);
|
$stack->push('Named Range', $cellValue, $namedRange);
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError("undefined variable '$token'");
|
return $this->raiseFormulaError("undefined variable '$token'");
|
||||||
|
@ -3814,13 +3807,13 @@ class Calculation
|
||||||
// If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
|
// If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
|
||||||
if ($operand > '' && $operand[0] == '#') {
|
if ($operand > '' && $operand[0] == '#') {
|
||||||
$stack->push('Value', $operand);
|
$stack->push('Value', $operand);
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) {
|
} elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) {
|
||||||
// If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
|
// If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
|
||||||
$stack->push('Value', '#VALUE!');
|
$stack->push('Value', '#VALUE!');
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
|
$this->debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3838,14 +3831,14 @@ class Calculation
|
||||||
$result = [];
|
$result = [];
|
||||||
if ((is_array($operand1)) && (!is_array($operand2))) {
|
if ((is_array($operand1)) && (!is_array($operand2))) {
|
||||||
foreach ($operand1 as $x => $operandData) {
|
foreach ($operand1 as $x => $operandData) {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2));
|
$this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2));
|
||||||
$this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
|
$this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
|
||||||
$r = $stack->pop();
|
$r = $stack->pop();
|
||||||
$result[$x] = $r['value'];
|
$result[$x] = $r['value'];
|
||||||
}
|
}
|
||||||
} elseif ((!is_array($operand1)) && (is_array($operand2))) {
|
} elseif ((!is_array($operand1)) && (is_array($operand2))) {
|
||||||
foreach ($operand2 as $x => $operandData) {
|
foreach ($operand2 as $x => $operandData) {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData));
|
$this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData));
|
||||||
$this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
|
$this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
|
||||||
$r = $stack->pop();
|
$r = $stack->pop();
|
||||||
$result[$x] = $r['value'];
|
$result[$x] = $r['value'];
|
||||||
|
@ -3855,14 +3848,14 @@ class Calculation
|
||||||
self::checkMatrixOperands($operand1, $operand2, 2);
|
self::checkMatrixOperands($operand1, $operand2, 2);
|
||||||
}
|
}
|
||||||
foreach ($operand1 as $x => $operandData) {
|
foreach ($operand1 as $x => $operandData) {
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x]));
|
$this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x]));
|
||||||
$this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true);
|
$this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true);
|
||||||
$r = $stack->pop();
|
$r = $stack->pop();
|
||||||
$result[$x] = $r['value'];
|
$result[$x] = $r['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Log the result details
|
// Log the result details
|
||||||
$this->_debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result));
|
||||||
// And push the result onto the stack
|
// And push the result onto the stack
|
||||||
$stack->push('Array', $result);
|
$stack->push('Array', $result);
|
||||||
|
|
||||||
|
@ -3946,7 +3939,7 @@ class Calculation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the result details
|
// Log the result details
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
||||||
// And push the result onto the stack
|
// And push the result onto the stack
|
||||||
$stack->push('Value', $result);
|
$stack->push('Value', $result);
|
||||||
|
|
||||||
|
@ -4000,7 +3993,7 @@ class Calculation
|
||||||
$matrixResult = $matrix->$matrixFunction($operand2);
|
$matrixResult = $matrix->$matrixFunction($operand2);
|
||||||
$result = $matrixResult->getArray();
|
$result = $matrixResult->getArray();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
||||||
$result = '#VALUE!';
|
$result = '#VALUE!';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4028,7 +4021,7 @@ class Calculation
|
||||||
if ($operand2 == 0) {
|
if ($operand2 == 0) {
|
||||||
// Trap for Divide by Zero error
|
// Trap for Divide by Zero error
|
||||||
$stack->push('Value', '#DIV/0!');
|
$stack->push('Value', '#DIV/0!');
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!'));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!'));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4044,7 +4037,7 @@ class Calculation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the result details
|
// Log the result details
|
||||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
|
||||||
// And push the result onto the stack
|
// And push the result onto the stack
|
||||||
$stack->push('Value', $result);
|
$stack->push('Value', $result);
|
||||||
|
|
||||||
|
@ -4091,7 +4084,6 @@ class Calculation
|
||||||
if (!isset($aReferences[1])) {
|
if (!isset($aReferences[1])) {
|
||||||
// Single cell in range
|
// Single cell in range
|
||||||
sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow);
|
sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow);
|
||||||
$cellValue = null;
|
|
||||||
if ($pSheet->cellExists($aReferences[0])) {
|
if ($pSheet->cellExists($aReferences[0])) {
|
||||||
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4102,7 +4094,6 @@ class Calculation
|
||||||
foreach ($aReferences as $reference) {
|
foreach ($aReferences as $reference) {
|
||||||
// Extract range
|
// Extract range
|
||||||
sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow);
|
sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow);
|
||||||
$cellValue = null;
|
|
||||||
if ($pSheet->cellExists($reference)) {
|
if ($pSheet->cellExists($reference)) {
|
||||||
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue