PHPExcel_Calculation (Multiton)

category | PHPExcel
package | PHPExcel_Calculation
copyright | Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## __clone implementation.

    __clone()

Cloning should not be allowed in a Singleton!

access | public

### Exceptions

`\PHPExcel_Calculation_Exception` |

## __destruct()

    __destruct()

## Parse a cell formula and calculate its value

    _calculateFormulaValue(string $formula, string $cellID, \PHPExcel_Cell $pCell) : mixed

### Parameters

#### $formula

`string`

The formula to parse and calculate

#### $cellID

`string`

The ID (e.g. A3) of the cell that we are calculating

#### $pCell

`\PHPExcel_Cell`

Cell to calculate

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`

## Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0

    _getMatrixDimensions(mixed $matrix) : array

Static

### Parameters

#### $matrix

`mixed`

&$matrix matrix operand

### Returns

`array`An array comprising the number of rows, and number of columns

## _localeFunc()

    _localeFunc($function)

Static

### Parameters

#### $function

## _translateFormulaToEnglish()

    _translateFormulaToEnglish($formula)

### Parameters

#### $formula

## _translateFormulaToLocale()

    _translateFormulaToLocale($formula)

### Parameters

#### $formula

## _translateSeparator()

    _translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces)

Static

### Parameters

#### $fromSeparator

#### $toSeparator

#### $formula

#### $inBraces

## Remove quotes used as a wrapper to identify string values

    _unwrapResult(mixed $value) : mixed

Static

### Parameters

#### $value

`mixed`

### Returns

`mixed`

## Wrap string values in quotes

    _wrapResult(mixed $value) : mixed

Static

### Parameters

#### $value

`mixed`

### Returns

`mixed`

## Calculate cell value (using formula from a cell ID) Retained for backward compatibility

    calculate(\PHPExcel_Cell $pCell) : mixed

access | public

### Parameters

#### $pCell

`\PHPExcel_Cell`

Cell to calculate

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`

## Calculate the value of a cell formula

    calculateCellValue(\PHPExcel_Cell $pCell, Boolean $resetLog) : mixed

access | public

### Parameters

#### $pCell

`\PHPExcel_Cell`

Cell to calculate

#### $resetLog

`Boolean`

Flag indicating whether the debug log should be reset or not

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`

## Calculate the value of a formula

    calculateFormula(string $formula, string $cellID, \PHPExcel_Cell $pCell) : mixed

### Parameters

#### $formula

`string`

Formula to parse

#### $cellID

`string`

Address of the cell to calculate

#### $pCell

`\PHPExcel_Cell`

Cell to calculate

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`

## Clear calculation cache

    clearCalculationCache()

## Clear calculation cache for a specified worksheet

    clearCalculationCacheForWorksheet(string $worksheetName)

### Parameters

#### $worksheetName

`string`

## Disable calculation cache

    disableCalculationCache()

## Enable calculation cache

    enableCalculationCache()

## Extract range values

    extractCellRange(string $pRange, \PHPExcel_Worksheet $pSheet, boolean $resetLog) : mixed

### Parameters

#### $pRange

`string`

&$pRange String based range representation

#### $pSheet

`\PHPExcel_Worksheet`

Worksheet

#### $resetLog

`boolean`

Flag indicating whether calculation log should be reset or not

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`Array of values in range if range contains more than one element. Otherwise, a single value is returned.

## Extract range values

    extractNamedRange(string $pRange, \PHPExcel_Worksheet $pSheet, boolean $resetLog) : mixed

### Parameters

#### $pRange

`string`

&$pRange String based range representation

#### $pSheet

`\PHPExcel_Worksheet`

Worksheet

#### $resetLog

`boolean`

Flag indicating whether calculation log should be reset or not

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`mixed`Array of values in range if range contains more than one element. Otherwise, a single value is returned.

## Flush the calculation cache for any existing instance of this class but only if a PHPExcel_Calculation instance exists

    flushInstance() : null

access | public

### Returns

`null`

## Return the Array Return Type (Array or Value of first element in the array)

    getArrayReturnType() : string

Static

access | public

### Returns

`string`$returnType Array return type

## Is calculation caching enabled?

    getCalculationCacheEnabled() : boolean

access | public

### Returns

`boolean`

## Get the debuglog for this claculation engine instance

    getDebugLog() : \PHPExcel_CalcEngine_Logger

access | public

### Returns

`\PHPExcel_CalcEngine_Logger`

## Return the locale-specific translation of FALSE

    getFALSE() : string

Static

access | public

### Returns

`string`locale-specific translation of FALSE

## Get an instance of this class

    getInstance(\PHPExcel $workbook) : \PHPExcel_Calculation

Static

access | public

### Parameters

#### $workbook

`\PHPExcel`

Injected workbook for working with a PHPExcel object, or NULL to create a standalone claculation engine

### Returns

`\PHPExcel_Calculation`

## Get the currently defined locale code

    getLocale() : string

### Returns

`string`

## Return the locale-specific translation of TRUE

    getTRUE() : string

Static

access | public

### Returns

`string`locale-specific translation of TRUE

## getValueFromCache()

    getValueFromCache($worksheetName, $cellID, $cellValue)

### Parameters

#### $worksheetName

#### $cellID

#### $cellValue

## Is a specific function implemented?

    isImplemented(string $pFunction) : boolean

### Parameters

#### $pFunction

`string`

Function Name

### Returns

`boolean`

## Get a list of all Excel function names

    listAllFunctionNames() : array

### Returns

`array`

## Get a list of implemented Excel function names

    listFunctionNames() : array

### Returns

`array`

## Get a list of all implemented functions as an array of function objects

    listFunctions() : array

### Returns

`array`of PHPExcel_Calculation_Function

## Validate and parse a formula string

    parseFormula(string $formula) : array

### Parameters

#### $formula

`string`

Formula to parse

### Exceptions

`\PHPExcel_Calculation_Exception` |

### Returns

`array`

## Rename calculation cache for a specified worksheet

    renameCalculationCacheForWorksheet(string $fromWorksheetName, string $toWorksheetName)

### Parameters

#### $fromWorksheetName

`string`

#### $toWorksheetName

`string`

## saveValueToCache()

    saveValueToCache($worksheetName, $cellID, $cellValue)

### Parameters

#### $worksheetName

#### $cellID

#### $cellValue

## Set the Array Return Type (Array or Value of first element in the array)

    setArrayReturnType(string $returnType) : boolean

Static

access | public

### Parameters

#### $returnType

`string`

Array return type

### Returns

`boolean`Success or failure

## Enable/disable calculation cache

    setCalculationCacheEnabled(boolean $pValue)

access | public

### Parameters

#### $pValue

`boolean`

## Set the locale code

    setLocale(string $locale) : boolean

### Parameters

#### $locale

`string`

The locale to use for formula translation

### Returns

`boolean`

## Unset an instance of this class

    unsetInstance(\PHPExcel $workbook)

Static

access | public

### Parameters

#### $workbook

`\PHPExcel`

Injected workbook identifying the instance to unset

## _raiseFormulaError()

    _raiseFormulaError($errorMessage)

### Parameters

#### $errorMessage

## __construct()

    __construct(\PHPExcel $workbook)

### Parameters

#### $workbook

## Ensure that paired matrix operands are both matrices and of the same size

    _checkMatrixOperands(mixed $operand1, mixed $operand2, integer $resize)

Static

### Parameters

#### $operand1

`mixed`

&$operand1 First matrix operand

#### $operand2

`mixed`

&$operand2 Second matrix operand

#### $resize

`integer`

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

## _convertMatrixReferences()

    _convertMatrixReferences($formula)

Static

### Parameters

#### $formula

## _dataTestReference()

    _dataTestReference($operandData)

Static

### Parameters

#### $operandData

## _executeBinaryComparisonOperation()

    _executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, $stack, $recursingArrays)

### Parameters

#### $cellID

#### $operand1

#### $operand2

#### $operation

#### $stack

#### $recursingArrays

## _executeNumericBinaryOperation()

    _executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, $stack)

### Parameters

#### $cellID

#### $operand1

#### $operand2

#### $operation

#### $matrixFunction

#### $stack

## _loadLocales()

    _loadLocales()

Static

## _mkMatrix()

    _mkMatrix()

Static

## _parseFormula()

    _parseFormula($formula, \PHPExcel_Cell $pCell)

### Parameters

#### $formula

#### $pCell

## _processTokenStack()

    _processTokenStack($tokens, $cellID, \PHPExcel_Cell $pCell)

### Parameters

#### $tokens

#### $cellID

#### $pCell

## Ensure that paired matrix operands are both matrices of the same size

    _resizeMatricesExtend(mixed $matrix1, mixed $matrix2, integer $matrix1Rows, integer $matrix1Columns, integer $matrix2Rows, integer $matrix2Columns)

Static

### Parameters

#### $matrix1

`mixed`

&$matrix1 First matrix operand

#### $matrix2

`mixed`

&$matrix2 Second matrix operand

#### $matrix1Rows

`integer`

Row size of first matrix operand

#### $matrix1Columns

`integer`

Column size of first matrix operand

#### $matrix2Rows

`integer`

Row size of second matrix operand

#### $matrix2Columns

`integer`

Column size of second matrix operand

## Ensure that paired matrix operands are both matrices of the same size

    _resizeMatricesShrink(mixed $matrix1, mixed $matrix2, integer $matrix1Rows, integer $matrix1Columns, integer $matrix2Rows, integer $matrix2Columns)

Static

### Parameters

#### $matrix1

`mixed`

&$matrix1 First matrix operand

#### $matrix2

`mixed`

&$matrix2 Second matrix operand

#### $matrix1Rows

`integer`

Row size of first matrix operand

#### $matrix1Columns

`integer`

Column size of first matrix operand

#### $matrix2Rows

`integer`

Row size of second matrix operand

#### $matrix2Columns

`integer`

Column size of second matrix operand

## Format type and details of an operand for display in the log (based on operand type)

    _showTypeDetails(mixed $value) : mixed

### Parameters

#### $value

`mixed`

First matrix operand

### Returns

`mixed`

## Format details of an operand for display in the log (based on operand type)

    _showValue(mixed $value) : mixed

### Parameters

#### $value

`mixed`

First matrix operand

### Returns

`mixed`

## _translateFormula()

    _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)

Static

### Parameters

#### $from

#### $to

#### $formula

#### $fromSeparator

#### $toSeparator

## _validateBinaryOperand()

    _validateBinaryOperand($cellID, $operand, $stack)

### Parameters

#### $cellID

#### $operand

#### $stack

### Properties

##

    $_localeBoolean : string[]

##

    $cyclicFormulaCount : integer

##

    $formulaError : string

access | public

##

    $suppressFormulaErrors : boolean

access | public

##

    $_ExcelConstants : string[]

##

    $_PHPExcelFunctions

##

    $_binaryOperators : array

access | private

##

    $_calculationCache : array

access | private

##

    $_calculationCacheEnabled : boolean

access | private

##

    $_comparisonOperators

##

    $_controlFunctions

##

    $_cyclicFormulaCell

##

    $_cyclicFormulaCount : integer

##

    $_cyclicReferenceStack : array

access | private

##

    $_instance : \PHPExcel_Calculation

access | private

##

    $_localeArgumentSeparator : string

##

    $_localeFunctions

##

    $_localeLanguage : string

##

    $_operatorAssociativity

##

    $_operatorPrecedence

##

    $_operators : array

access | private

##

    $_savedPrecision : integer

##

    $_validLocaleLanguages : string[]

##

    $_workbook : \PHPExcel

access | private

##

    $_workbookSets : \PHPExcel_Calculation[]

access | private

##

    $debugLog : \PHPExcel_CalcEngine_Logger

access | private

##

    $functionReplaceFromExcel

##

    $functionReplaceFromLocale

##

    $functionReplaceToExcel

##

    $functionReplaceToLocale

##

    $returnArrayAsType

### Constants

## CALCULATION_REGEXP_CELLREF

    CALCULATION_REGEXP_CELLREF

## CALCULATION_REGEXP_ERROR

    CALCULATION_REGEXP_ERROR

## CALCULATION_REGEXP_FUNCTION

    CALCULATION_REGEXP_FUNCTION

## CALCULATION_REGEXP_NAMEDRANGE

    CALCULATION_REGEXP_NAMEDRANGE

## CALCULATION_REGEXP_NUMBER

    CALCULATION_REGEXP_NUMBER

## CALCULATION_REGEXP_OPENBRACE

    CALCULATION_REGEXP_OPENBRACE

## CALCULATION_REGEXP_STRING

    CALCULATION_REGEXP_STRING

## RETURN_ARRAY_AS_ARRAY

    RETURN_ARRAY_AS_ARRAY

## constants

    RETURN_ARRAY_AS_ERROR

## RETURN_ARRAY_AS_VALUE

    RETURN_ARRAY_AS_VALUE