Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
Static Public Member Functions | Data Fields | Static Protected Member Functions
CalculatedNumberUtil Class Reference

Static Public Member Functions

static calculateByFormulaAndModelAndResolveFormat ($formula, RedBeanModel $model)
 
static calculateByFormulaAndModel ($formula, RedBeanModel $model, &$formatType, &$currencyCode)
 
static isFormulaValid ($formula, $modelClassName)
 

Data Fields

const FORMAT_TYPE_INTEGER = 1
 
const FORMAT_TYPE_DECIMAL = 2
 
const FORMAT_TYPE_CURRENCY_VALUE = 3
 

Static Protected Member Functions

static calculateByExpressionAndModel ($expression, RedBeanModel $model, &$formatType, &$currencyCode)
 
static getIfStatementParts ($formula)
 
static getConditionParts ($condition)
 
static isExpressionValid ($expression, $modelClassName)
 
static isString ($expression)
 
static isAttribute ($expression, $modelClassName)
 
static isConditionValid ($condition, $modelClassName)
 
static isIfStatementValid ($condition, $trueExpression, $falseExpression, $modelClassName)
 
static mathEval ($equation)
 
static resolveFormatTypeAndCurrencyCode (&$formatType, &$currencyCode, $model, $attribute)
 

Detailed Description

Helper class to work with calculated numbers.

Definition at line 40 of file CalculatedNumberUtil.php.

Member Function Documentation

static calculateByFormulaAndModelAndResolveFormat (   $formula,
RedBeanModel  $model 
)
static

Calculate the formula and resolve the correct formula based on the attributes included in the formula

Parameters
$formula
RedBeanModel$model
Returns
mixed
Exceptions
NotSupportedException

Definition at line 55 of file CalculatedNumberUtil.php.

static calculateByFormulaAndModel (   $formula,
RedBeanModel  $model,
$formatType,
$currencyCode 
)
static

Given a formula string and a model, calculate the number using the formula and values from the attributes on the model.

Parameters
string$formula
RedBeanModel$model
$formatType
$currencyCode
Returns
bool|int|string calculated value as number.

Definition at line 91 of file CalculatedNumberUtil.php.

static isFormulaValid (   $formula,
  $modelClassName 
)
static

Given a formula string and a model, determine if the formula is correctly formed and is using valid attributes from the given model.

Parameters
$formula
$modelClassName
Returns
bool

Definition at line 208 of file CalculatedNumberUtil.php.


The documentation for this class was generated from the following file:
Generated on Fri Jul 10 2020 07:10:41
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.