Expression
class Expression
This class represents an arithmetic or a logical expression.
Properties
protected array | $tokens | ||
protected bool | $postfixed |
Methods
Returns the token list of this expression.
Sets the token list of this expression
Implementation of the Shunting Yard algorithm to transform an infix expression to a RPN expression.
Sets the value of all tokens with type T_FIELD
Sets the value of all tokens with type T_IDENT
Sets the value of all tokens with type T_IDENT or T_FIELD
Converts the given value into a DateTime object and sets the value of the given token with the result.
Details
at line 61
array
get()
Returns the token list of this expression.
at line 73
void
set(array $tokens)
Sets the token list of this expression
at line 86
void
push(Token $t)
Adds a token at the end of the token list of this expression.
at line 97
Token
pop()
Returns the last added token of this expression and removes it from the list of tokens.
at line 108
Token
peek()
Returns the last added token of this expression
at line 120
void
postfix()
Implementation of the Shunting Yard algorithm to transform an infix expression to a RPN expression.
at line 196
void
setFields(array $fields)
Sets the value of all tokens with type T_FIELD
at line 212
setNamedFields(array $fields)
Sets the value of all tokens with type T_IDENT
at line 229
bool
setVariables(array $variables)
Sets the value of all tokens with type T_IDENT or T_FIELD
at line 256
protected void
setToken(Token $token, string $value)
Detects the type of the given value, converts it according to this type and sets the value of the given token with the result.
at line 284
protected void
setDateToken(Token $token, string $value)
Converts the given value into a DateTime object and sets the value of the given token with the result.
at line 296
Token|false
evaluate()
Evaluates this expression