Calculation
extends CalculationLocale
in package
Table of Contents
Constants
- CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?\$?\b([a-z]{1,3})\$?(\d{1,7})(?![\w.])'
- CALCULATION_REGEXP_CELLREF_RELATIVE = '((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?(\$?\b[a-z]{1,3})(\$?\d{1,7})(?![\w.])'
- CALCULATION_REGEXP_CELLREF_SPILL = '/' . self::CALCULATION_REGEXP_CELLREF . '#/i'
- CALCULATION_REGEXP_COLUMN_RANGE = '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\".(?:[^\"]|\"[^!])?\"))!)?(\$?[a-z]{1,3})):(?![.*])'
- CALCULATION_REGEXP_COLUMNRANGE_RELATIVE = '(\$?[a-z]{1,3}):(\$?[a-z]{1,3})'
- CALCULATION_REGEXP_DEFINEDNAME = '((([^\s,!&%^\/\*\+<>=-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?([_\p{L}][_\p{L}\p{N}\.]*)'
- CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'
- CALCULATION_REGEXP_FUNCTION = '@?(?:_xlfn\.)?(?:_xlws\.)?((?:__xludf\.)?[\p{L}][\p{L}\p{N}\.]*)[\s]*\('
- CALCULATION_REGEXP_NUMBER = '[-+]?\d*\.?\d+(e[-+]?\d+)?'
- Regular Expressions
- CALCULATION_REGEXP_OPENBRACE = '\('
- CALCULATION_REGEXP_ROW_RANGE = '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?(\$?[1-9][0-9]{0,6})):(?![.*])'
- CALCULATION_REGEXP_ROWRANGE_RELATIVE = '(\$?\d{1,7}):(\$?\d{1,7})'
- CALCULATION_REGEXP_STRING = '"(?:[^"]|"")*"'
- CALCULATION_REGEXP_STRIP_XLFN_XLWS = '/(_xlfn[.])?(_xlws[.])?(?=[\p{L}][\p{L}\p{N}\.]*[\s]*[(])/'
- CALCULATION_REGEXP_STRUCTURED_REFERENCE = '([\p{L}_\\\\][\p{L}\p{N}\._]+)?(\[(?:[^\d\]+-])?)'
- FORMULA_CLOSE_FUNCTION_BRACE = ')'
- FORMULA_CLOSE_MATRIX_BRACE = '}'
- FORMULA_OPEN_FUNCTION_BRACE = '('
- FORMULA_OPEN_MATRIX_BRACE = '{'
- FORMULA_STRING_QUOTE = '"'
- RETURN_ARRAY_AS_ARRAY = 'array'
- RETURN_ARRAY_AS_ERROR = 'error'
- constants
- RETURN_ARRAY_AS_VALUE = 'value'
- UNIONABLE_COMMAS = '/((?:[,(]|^)\s*)' . '([(]' . self::CELL_OR_CELLRANGE_OR_DEFINED_NAME . '(?:\s*,\s*' . self::CELL_OR_CELLRANGE_OR_DEFINED_NAME . ')+' . '\s*[)])/i'
Properties
- $cyclicFormulaCount : int
- Number of iterations for cyclic formulae.
- $formulaError : string|null
- Error message for any error that was raised/thrown by the calculation engine.
- $branchPruningEnabled : bool
- $falseTrueArray : array<int, array<int, string>>
- $functionReplaceFromLocale : null|array<string|int, string>
- $functionReplaceToExcel : null|array<string|int, string>
- $localeArgumentSeparator : string
- Locale-specific argument separator for function arguments.
- $localeBoolean : array<string, string>
- Locale-specific translations for Excel constants (True, False and Null).
- $localeFunctions : array<string|int, string>
- $localeLanguage : string
- The current locale setting.
- $validLocaleLanguages : array<string|int, string>
- List of available locale settings Note that this is read for the locale subdirectory only when requested.
Methods
- __clone() : mixed
- __clone implementation. Cloning should not be allowed in a Singleton!
- __construct() : mixed
- _calculateFormulaValue() : mixed
- addFunction() : bool
- boolToString() : mixed
- calculate() : mixed
- Calculate cell value (using formula from a cell ID) Retained for backward compatibility.
- calculateCellValue() : mixed
- Calculate the value of a cell formula.
- calculateFormula() : mixed
- Calculate the value of a formula.
- calculateFormulaValue() : mixed
- Parse a cell formula and calculate its value.
- checkMatrixOperands() : array<string|int, mixed>
- Ensure that paired matrix operands are both matrices and of the same size.
- clearCalculationCache() : void
- Clear calculation cache.
- clearCalculationCacheForWorksheet() : void
- Clear calculation cache for a specified worksheet.
- clearFormulaTokenCache() : void
- Clear the formula token cache.
- disableBranchPruning() : void
- disableCalculationCache() : void
- Disable calculation cache.
- enableBranchPruning() : void
- enableCalculationCache() : void
- Enable calculation cache.
- extractCellRange() : array<string|int, mixed>
- Extract range values.
- extractNamedRange() : array<string|int, mixed>|string
- Extract range values.
- flushInstance() : void
- Flush the calculation cache for any existing instance of this class but only if a Calculation instance exists.
- getArrayReturnType() : string
- Return the Array Return Type (Array or Value of first element in the array).
- getBranchPruningEnabled() : bool
- getCalculationCacheEnabled() : bool
- Is calculation caching enabled?
- getDebugLog() : Logger
- Get the Logger for this calculation engine instance.
- getExcelConstants() : bool|null
- getFALSE() : string
- Return the locale-specific translation of FALSE.
- getFalseTrueArray() : array<int, array<int, string>>
- getFormulaTokenCacheMaxSize() : int
- Get the maximum number of entries allowed in the formula token cache.
- getFormulaTokenCacheSize() : int
- Get the current number of entries in the formula token cache.
- getFunctions() : array<string, array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool}>
- Get a list of all implemented functions as an array of function objects.
- getImplementedFunctionNames() : array<string|int, string>
- Get a list of implemented Excel function names.
- getInstance() : self
- Get an instance of this class.
- getInstanceArrayReturnType() : string
- Return the Array Return Type (Array or Value of first element in the array).
- getLocale() : string
- Get the currently defined locale code.
- getLocaleBoolean() : string
- getMatrixDimensions() : array<string|int, int>
- Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0.
- getSpreadsheet() : Spreadsheet|null
- getSuppressFormulaErrors() : bool
- getTRUE() : string
- Return the locale-specific translation of TRUE.
- getValueFromCache() : bool
- isImplemented() : bool
- Is a specific function implemented?
- keyInExcelConstants() : bool
- localeFunc() : string
- parseFormula() : array<string|int, mixed>|bool
- Validate and parse a formula string.
- removeFunction() : bool
- renameCalculationCacheForWorksheet() : void
- Rename calculation cache for a specified worksheet.
- saveValueToCache() : void
- setArrayReturnType() : bool
- Set the Array Return Type (Array or Value of first element in the array).
- setBranchPruningEnabled() : self
- setCalculationCacheEnabled() : self
- Enable/disable calculation cache.
- setFormulaTokenCacheMaxSize() : self
- Set the maximum number of entries in the formula token cache.
- setInstanceArrayReturnType() : bool
- Set the Instance Array Return Type (Array or Value of first element in the array).
- setLocale() : bool
- Set the locale code.
- setSuppressFormulaErrors() : self
- translateFormulaToEnglish() : string
- translateFormulaToLocale() : string
- translateSeparator() : string
- unwrapResult() : mixed
- Remove quotes used as a wrapper to identify string values.
- wrapResult() : mixed
- Wrap string values in quotes.
- getFunctionsAddress() : array<string, array<string, mixed>>
- Get address of list of all implemented functions as an array of function objects.
- getLocaleFile() : string
- loadLocales() : void
- raiseFormulaError() : false
- Trigger an error, but nicely, if need be.
- translateFormula() : string
- translateFormulaBlock() : string
Constants
CALCULATION_REGEXP_CELLREF
public
mixed
CALCULATION_REGEXP_CELLREF
= '((([^\s,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?\$?\b([a-z]{1,3})\$?(\d{1,7})(?![\w.])'
CALCULATION_REGEXP_CELLREF_RELATIVE
public
mixed
CALCULATION_REGEXP_CELLREF_RELATIVE
= '((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?(\$?\b[a-z]{1,3})(\$?\d{1,7})(?![\w.])'
CALCULATION_REGEXP_CELLREF_SPILL
public
mixed
CALCULATION_REGEXP_CELLREF_SPILL
= '/' . self::CALCULATION_REGEXP_CELLREF . '#/i'
CALCULATION_REGEXP_COLUMN_RANGE
public
mixed
CALCULATION_REGEXP_COLUMN_RANGE
= '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\".(?:[^\"]|\"[^!])?\"))!)?(\$?[a-z]{1,3})):(?![.*])'
CALCULATION_REGEXP_COLUMNRANGE_RELATIVE
public
mixed
CALCULATION_REGEXP_COLUMNRANGE_RELATIVE
= '(\$?[a-z]{1,3}):(\$?[a-z]{1,3})'
CALCULATION_REGEXP_DEFINEDNAME
public
mixed
CALCULATION_REGEXP_DEFINEDNAME
= '((([^\s,!&%^\/\*\+<>=-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?([_\p{L}][_\p{L}\p{N}\.]*)'
CALCULATION_REGEXP_ERROR
public
mixed
CALCULATION_REGEXP_ERROR
= '\#[A-Z][A-Z0_\/]*[!\?]?'
CALCULATION_REGEXP_FUNCTION
public
mixed
CALCULATION_REGEXP_FUNCTION
= '@?(?:_xlfn\.)?(?:_xlws\.)?((?:__xludf\.)?[\p{L}][\p{L}\p{N}\.]*)[\s]*\('
CALCULATION_REGEXP_NUMBER
Regular Expressions
public
mixed
CALCULATION_REGEXP_NUMBER
= '[-+]?\d*\.?\d+(e[-+]?\d+)?'
CALCULATION_REGEXP_OPENBRACE
public
mixed
CALCULATION_REGEXP_OPENBRACE
= '\('
CALCULATION_REGEXP_ROW_RANGE
public
mixed
CALCULATION_REGEXP_ROW_RANGE
= '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?(\$?[1-9][0-9]{0,6})):(?![.*])'
CALCULATION_REGEXP_ROWRANGE_RELATIVE
public
mixed
CALCULATION_REGEXP_ROWRANGE_RELATIVE
= '(\$?\d{1,7}):(\$?\d{1,7})'
CALCULATION_REGEXP_STRING
public
mixed
CALCULATION_REGEXP_STRING
= '"(?:[^"]|"")*"'
CALCULATION_REGEXP_STRIP_XLFN_XLWS
public
mixed
CALCULATION_REGEXP_STRIP_XLFN_XLWS
= '/(_xlfn[.])?(_xlws[.])?(?=[\p{L}][\p{L}\p{N}\.]*[\s]*[(])/'
CALCULATION_REGEXP_STRUCTURED_REFERENCE
public
mixed
CALCULATION_REGEXP_STRUCTURED_REFERENCE
= '([\p{L}_\\\\][\p{L}\p{N}\._]+)?(\[(?:[^\d\]+-])?)'
FORMULA_CLOSE_FUNCTION_BRACE
public
mixed
FORMULA_CLOSE_FUNCTION_BRACE
= ')'
FORMULA_CLOSE_MATRIX_BRACE
public
mixed
FORMULA_CLOSE_MATRIX_BRACE
= '}'
FORMULA_OPEN_FUNCTION_BRACE
public
mixed
FORMULA_OPEN_FUNCTION_BRACE
= '('
FORMULA_OPEN_MATRIX_BRACE
public
mixed
FORMULA_OPEN_MATRIX_BRACE
= '{'
FORMULA_STRING_QUOTE
public
mixed
FORMULA_STRING_QUOTE
= '"'
RETURN_ARRAY_AS_ARRAY
public
mixed
RETURN_ARRAY_AS_ARRAY
= 'array'
RETURN_ARRAY_AS_ERROR
constants
public
mixed
RETURN_ARRAY_AS_ERROR
= 'error'
RETURN_ARRAY_AS_VALUE
public
mixed
RETURN_ARRAY_AS_VALUE
= 'value'
UNIONABLE_COMMAS
public
mixed
UNIONABLE_COMMAS
= '/((?:[,(]|^)\s*)' . '([(]' . self::CELL_OR_CELLRANGE_OR_DEFINED_NAME . '(?:\s*,\s*' . self::CELL_OR_CELLRANGE_OR_DEFINED_NAME . ')+' . '\s*[)])/i'
Properties
$cyclicFormulaCount
Number of iterations for cyclic formulae.
public
int
$cyclicFormulaCount
= 1
$formulaError
Error message for any error that was raised/thrown by the calculation engine.
public
string|null
$formulaError
= null
$branchPruningEnabled
protected
bool
$branchPruningEnabled
= true
$falseTrueArray
protected
static array<int, array<int, string>>
$falseTrueArray
= []
$functionReplaceFromLocale
protected
static null|array<string|int, string>
$functionReplaceFromLocale
$functionReplaceToExcel
protected
static null|array<string|int, string>
$functionReplaceToExcel
$localeArgumentSeparator
Locale-specific argument separator for function arguments.
protected
static string
$localeArgumentSeparator
= ','
$localeBoolean
Locale-specific translations for Excel constants (True, False and Null).
protected
static array<string, string>
$localeBoolean
= ['TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL']
$localeFunctions
protected
static array<string|int, string>
$localeFunctions
= []
$localeLanguage
The current locale setting.
protected
static string
$localeLanguage
= 'en_us'
$validLocaleLanguages
List of available locale settings Note that this is read for the locale subdirectory only when requested.
protected
static array<string|int, string>
$validLocaleLanguages
= ['en']
Methods
__clone()
__clone implementation. Cloning should not be allowed in a Singleton!
public
final __clone() : mixed
__construct()
public
__construct([Spreadsheet|null $spreadsheet = null ]) : mixed
Parameters
- $spreadsheet : Spreadsheet|null = null
_calculateFormulaValue()
public
_calculateFormulaValue(string $formula[, string|null $cellID = null ][, Cell|null $cell = null ][, bool $ignoreQuotePrefix = false ]) : mixed
use calculateFormulaValue
Parameters
- $formula : string
- $cellID : string|null = null
- $cell : Cell|null = null
- $ignoreQuotePrefix : bool = false
addFunction()
public
static addFunction(string $key, array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool} $value) : bool
Parameters
- $key : string
- $value : array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool}
Return values
boolboolToString()
public
static boolToString(mixed $operand1) : mixed
Parameters
- $operand1 : mixed
calculate()
Calculate cell value (using formula from a cell ID) Retained for backward compatibility.
public
calculate([Cell|null $cell = null ]) : mixed
Parameters
- $cell : Cell|null = null
-
Cell to calculate
calculateCellValue()
Calculate the value of a cell formula.
public
calculateCellValue([Cell|null $cell = null ][, bool $resetLog = true ]) : mixed
Parameters
- $cell : Cell|null = null
-
Cell to calculate
- $resetLog : bool = true
-
Flag indicating whether the debug log should be reset or not
calculateFormula()
Calculate the value of a formula.
public
calculateFormula(string $formula[, string|null $cellID = null ][, Cell|null $cell = null ]) : mixed
Parameters
- $formula : string
-
Formula to parse
- $cellID : string|null = null
-
Address of the cell to calculate
- $cell : Cell|null = null
-
Cell to calculate
calculateFormulaValue()
Parse a cell formula and calculate its value.
public
calculateFormulaValue(string $formula[, string|null $cellID = null ][, Cell|null $cell = null ][, bool $ignoreQuotePrefix = false ]) : mixed
Parameters
- $formula : string
-
The formula to parse and calculate
- $cellID : string|null = null
-
The ID (e.g. A3) of the cell that we are calculating
- $cell : Cell|null = null
-
Cell to calculate
- $ignoreQuotePrefix : bool = false
-
If set to true, evaluate the formula even if the referenced cell is quote prefixed
checkMatrixOperands()
Ensure that paired matrix operands are both matrices and of the same size.
public
static checkMatrixOperands(mixed &$operand1, mixed &$operand2[, int $resize = 1 ]) : array<string|int, mixed>
Parameters
- $operand1 : mixed
-
First matrix operand
- $operand2 : mixed
-
Second matrix operand
- $resize : int = 1
-
Flag indicating whether the matrices should be resized to match and (if so), whether the smaller dimension should grow or the larger should shrink. 0 = no resize 1 = shrink to fit 2 = extend to fit
Tags
Return values
array<string|int, mixed>clearCalculationCache()
Clear calculation cache.
public
clearCalculationCache() : void
clearCalculationCacheForWorksheet()
Clear calculation cache for a specified worksheet.
public
clearCalculationCacheForWorksheet(string $worksheetName) : void
Parameters
- $worksheetName : string
clearFormulaTokenCache()
Clear the formula token cache.
public
clearFormulaTokenCache() : void
disableBranchPruning()
public
disableBranchPruning() : void
disableCalculationCache()
Disable calculation cache.
public
disableCalculationCache() : void
enableBranchPruning()
public
enableBranchPruning() : void
enableCalculationCache()
Enable calculation cache.
public
enableCalculationCache() : void
extractCellRange()
Extract range values.
public
extractCellRange([string &$range = 'A1' ][, Worksheet|null $worksheet = null ][, bool $resetLog = true ][, bool $createCell = false ]) : array<string|int, mixed>
Parameters
- $range : string = 'A1'
-
String based range representation
- $worksheet : Worksheet|null = null
-
Worksheet
- $resetLog : bool = true
-
Flag indicating whether calculation log should be reset or not
- $createCell : bool = false
Return values
array<string|int, mixed> —Array of values in range if range contains more than one element. Otherwise, a single value is returned.
extractNamedRange()
Extract range values.
public
extractNamedRange([string &$range = 'A1' ][, null|Worksheet $worksheet = null ][, bool $resetLog = true ]) : array<string|int, mixed>|string
Parameters
- $range : string = 'A1'
-
String based range representation
- $worksheet : null|Worksheet = null
-
Worksheet
- $resetLog : bool = true
-
Flag indicating whether calculation log should be reset or not
Return values
array<string|int, mixed>|string —Array of values in range if range contains more than one element. Otherwise, a single value is returned.
flushInstance()
Flush the calculation cache for any existing instance of this class but only if a Calculation instance exists.
public
flushInstance() : void
getArrayReturnType()
Return the Array Return Type (Array or Value of first element in the array).
public
static getArrayReturnType() : string
Return values
string —$returnType Array return type
getBranchPruningEnabled()
public
getBranchPruningEnabled() : bool
Return values
boolgetCalculationCacheEnabled()
Is calculation caching enabled?
public
getCalculationCacheEnabled() : bool
Return values
boolgetDebugLog()
Get the Logger for this calculation engine instance.
public
getDebugLog() : Logger
Return values
LoggergetExcelConstants()
public
static getExcelConstants(string $key) : bool|null
Parameters
- $key : string
Return values
bool|nullgetFALSE()
Return the locale-specific translation of FALSE.
public
static getFALSE() : string
Return values
string —locale-specific translation of FALSE
getFalseTrueArray()
public
getFalseTrueArray() : array<int, array<int, string>>
Return values
array<int, array<int, string>>getFormulaTokenCacheMaxSize()
Get the maximum number of entries allowed in the formula token cache.
public
getFormulaTokenCacheMaxSize() : int
Return values
intgetFormulaTokenCacheSize()
Get the current number of entries in the formula token cache.
public
getFormulaTokenCacheSize() : int
Return values
intgetFunctions()
Get a list of all implemented functions as an array of function objects.
public
static getFunctions() : array<string, array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool}>
Return values
array<string, array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool}>getImplementedFunctionNames()
Get a list of implemented Excel function names.
public
getImplementedFunctionNames() : array<string|int, string>
Return values
array<string|int, string>getInstance()
Get an instance of this class.
public
static getInstance([Spreadsheet|null $spreadsheet = null ]) : self
Parameters
- $spreadsheet : Spreadsheet|null = null
-
Injected spreadsheet for working with a PhpSpreadsheet Spreadsheet object, or NULL to create a standalone calculation engine
Return values
selfgetInstanceArrayReturnType()
Return the Array Return Type (Array or Value of first element in the array).
public
getInstanceArrayReturnType() : string
Return values
string —$returnType Array return type for instance if non-null, otherwise static property
getLocale()
Get the currently defined locale code.
public
getLocale() : string
Return values
stringgetLocaleBoolean()
public
static getLocaleBoolean(string $index) : string
Parameters
- $index : string
Return values
stringgetMatrixDimensions()
Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0.
public
static getMatrixDimensions(array<string|int, mixed> &$matrix) : array<string|int, int>
Parameters
- $matrix : array<string|int, mixed>
-
matrix operand
Return values
array<string|int, int> —An array comprising the number of rows, and number of columns
getSpreadsheet()
public
getSpreadsheet() : Spreadsheet|null
Return values
Spreadsheet|nullgetSuppressFormulaErrors()
public
getSuppressFormulaErrors() : bool
Return values
boolgetTRUE()
Return the locale-specific translation of TRUE.
public
static getTRUE() : string
Return values
string —locale-specific translation of TRUE
getValueFromCache()
public
getValueFromCache(string $cellReference, mixed &$cellValue) : bool
Parameters
- $cellReference : string
- $cellValue : mixed
Return values
boolisImplemented()
Is a specific function implemented?
public
isImplemented(string $function) : bool
Parameters
- $function : string
-
Function Name
Return values
boolkeyInExcelConstants()
public
static keyInExcelConstants(string $key) : bool
Parameters
- $key : string
Return values
boollocaleFunc()
public
static localeFunc(string $function) : string
Parameters
- $function : string
Return values
stringparseFormula()
Validate and parse a formula string.
public
parseFormula(string $formula) : array<string|int, mixed>|bool
Parameters
- $formula : string
-
Formula to parse
Return values
array<string|int, mixed>|boolremoveFunction()
public
static removeFunction(string $key) : bool
Parameters
- $key : string
Return values
boolrenameCalculationCacheForWorksheet()
Rename calculation cache for a specified worksheet.
public
renameCalculationCacheForWorksheet(string $fromWorksheetName, string $toWorksheetName) : void
Parameters
- $fromWorksheetName : string
- $toWorksheetName : string
saveValueToCache()
public
saveValueToCache(string $cellReference, mixed $cellValue) : void
Parameters
- $cellReference : string
- $cellValue : mixed
setArrayReturnType()
Set the Array Return Type (Array or Value of first element in the array).
public
static setArrayReturnType(string $returnType) : bool
Parameters
- $returnType : string
-
Array return type
Return values
bool —Success or failure
setBranchPruningEnabled()
public
setBranchPruningEnabled(mixed $enabled) : self
Parameters
- $enabled : mixed
Return values
selfsetCalculationCacheEnabled()
Enable/disable calculation cache.
public
setCalculationCacheEnabled(bool $calculationCacheEnabled) : self
Parameters
- $calculationCacheEnabled : bool
Return values
selfsetFormulaTokenCacheMaxSize()
Set the maximum number of entries in the formula token cache.
public
setFormulaTokenCacheMaxSize(int $size) : self
Set to 0 to disable caching (default), or a positive integer to enable.
Parameters
- $size : int
Return values
selfsetInstanceArrayReturnType()
Set the Instance Array Return Type (Array or Value of first element in the array).
public
setInstanceArrayReturnType(string $returnType) : bool
Parameters
- $returnType : string
-
Array return type
Return values
bool —Success or failure
setLocale()
Set the locale code.
public
setLocale(string $locale) : bool
Parameters
- $locale : string
-
The locale to use for formula translation, eg: 'en_us'
Return values
boolsetSuppressFormulaErrors()
public
setSuppressFormulaErrors(bool $suppressFormulaErrors) : self
Parameters
- $suppressFormulaErrors : bool
Return values
selftranslateFormulaToEnglish()
public
translateFormulaToEnglish(string $formula) : string
Parameters
- $formula : string
Return values
stringtranslateFormulaToLocale()
public
translateFormulaToLocale(string $formula) : string
Parameters
- $formula : string
Return values
stringtranslateSeparator()
public
static translateSeparator(string $fromSeparator, string $toSeparator, string $formula, int &$inBracesLevel[, string $openBrace = self::FORMULA_OPEN_FUNCTION_BRACE ][, string $closeBrace = self::FORMULA_CLOSE_FUNCTION_BRACE ]) : string
Parameters
- $fromSeparator : string
- $toSeparator : string
- $formula : string
- $inBracesLevel : int
- $openBrace : string = self::FORMULA_OPEN_FUNCTION_BRACE
- $closeBrace : string = self::FORMULA_CLOSE_FUNCTION_BRACE
Return values
stringunwrapResult()
Remove quotes used as a wrapper to identify string values.
public
static unwrapResult(mixed $value) : mixed
Parameters
- $value : mixed
wrapResult()
Wrap string values in quotes.
public
static wrapResult(mixed $value) : mixed
Parameters
- $value : mixed
getFunctionsAddress()
Get address of list of all implemented functions as an array of function objects.
protected
static & getFunctionsAddress() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>getLocaleFile()
protected
getLocaleFile(string $localeDir, string $locale, string $language, string $file) : string
Parameters
- $localeDir : string
- $locale : string
- $language : string
- $file : string
Return values
stringloadLocales()
protected
static loadLocales() : void
raiseFormulaError()
Trigger an error, but nicely, if need be.
protected
raiseFormulaError(string $errorMessage[, int $code = 0 ][, Throwable|null $exception = null ]) : false
Parameters
- $errorMessage : string
- $code : int = 0
- $exception : Throwable|null = null
Return values
falsetranslateFormula()
protected
static translateFormula(array<string|int, string> $from, array<string|int, string> $to, string $formula, string $fromSeparator, string $toSeparator) : string
Parameters
- $from : array<string|int, string>
- $to : array<string|int, string>
- $formula : string
- $fromSeparator : string
- $toSeparator : string
Return values
stringtranslateFormulaBlock()
protected
static translateFormulaBlock(array<string|int, string> $from, array<string|int, string> $to, string $formula, int &$inFunctionBracesLevel, int &$inMatrixBracesLevel, string $fromSeparator, string $toSeparator) : string
Parameters
- $from : array<string|int, string>
- $to : array<string|int, string>
- $formula : string
- $inFunctionBracesLevel : int
- $inMatrixBracesLevel : int
- $fromSeparator : string
- $toSeparator : string