dolibarr 21.0.0-alpha
EvalMath Class Reference

Class EvalMath. More...

Public Member Functions

 __construct ()
 Constructor.
 
 e ($expr)
 Evaluate.
 
 evaluate ($expr)
 Evaluate.
 
 vars ()
 Function vars.
 
 trigger ($code, $msg, $info=null)
 trigger an error, but nicely, if need be
 

Private Member Functions

 funcs ()
 Function funcs.
 
 nfx ($expr)
 Convert infix to postfix notation.
 
 pfx ($tokens, $vars=array())
 Evaluate postfix notation.
 

Detailed Description

Class EvalMath.

Definition at line 101 of file evalmath.class.php.

Member Function Documentation

◆ e()

EvalMath::e ( $expr)

Evaluate.

Parameters
string$exprString
Returns
boolean|int|float|NULL|mixed Result

Definition at line 156 of file evalmath.class.php.

References evaluate().

◆ evaluate()

EvalMath::evaluate ( $expr)

Evaluate.

Parameters
string$exprString
Returns
boolean|int|float|NULL|mixed Result

Definition at line 167 of file evalmath.class.php.

References nfx(), pfx(), and trigger().

Referenced by e().

◆ funcs()

EvalMath::funcs ( )
private

Function funcs.

Returns
string[] Output

Definition at line 239 of file evalmath.class.php.

◆ nfx()

EvalMath::nfx ( $expr)
private

Convert infix to postfix notation.

Parameters
string$exprExpression
Returns
boolean|array<string|float> Output

Definition at line 256 of file evalmath.class.php.

References trigger().

Referenced by evaluate().

◆ pfx()

EvalMath::pfx ( $tokens,
$vars = array() )
private

Evaluate postfix notation.

Parameters
string[]$tokensExpression
array<string,string>$vars Array
Returns
string|false Output or false if error

Definition at line 402 of file evalmath.class.php.

References pfx(), and trigger().

Referenced by evaluate(), and pfx().

◆ trigger()

EvalMath::trigger ( $code,
$msg,
$info = null )

trigger an error, but nicely, if need be

Parameters
int$codeCode
string$msgMsg
null|string|array{0:?mixed,1:int}$info String
Returns
false

Definition at line 490 of file evalmath.class.php.

Referenced by evaluate(), nfx(), and pfx().

◆ vars()

EvalMath::vars ( )

Function vars.

Returns
array<string,float> Output

Definition at line 226 of file evalmath.class.php.


The documentation for this class was generated from the following file: