Engine
class Engine (View source)
internal |
Validation expression language engine.
Engine/Parser implementation for the Mighty Validation Expression Language (mVEL) v1
(v1.*.*
).
Methods
Cleans (minifies) the validation expression by removing comments and unnecessary whitespace from it.
Returns valid rule arguments by stringifing the passed array.
Returns a valid rule name as per convention.
Returns a valid rule statement from the passed name and arguments.
Evaluates a bitwise expression string and returns its boolean result.
Evaluates the passed validation expression string using the provided statements results.
No description
Parses the validation expression by extracting the validations into an array of checks.
Parses the rule statement by extracting rule name and rule arguments.
Details
static string
cleanExpression(string $expression)
Cleans (minifies) the validation expression by removing comments and unnecessary whitespace from it.
static string
createRuleArguments(array $arguments)
Returns valid rule arguments by stringifing the passed array.
static string
createRuleName(string $name)
Returns a valid rule name as per convention.
static string
createRuleStatement(string $name, string $arguments = '')
Returns a valid rule statement from the passed name and arguments.
static bool
evaluateBitwiseExpression(string $expression)
Evaluates a bitwise expression string and returns its boolean result.
NOTE: The expression may only contain the following characters: 0
, 1
, ~
, &
, |
, ^
, (
, )
.
Which are the subset of Bitwise that is the same as Boolean Algebra (returns a boolean value).
The expression may also have whitespace characters (spaces, tabs, new lines), these will simply be discarded.
static array
evaluateExpression(string $expression, array $results)
Evaluates the passed validation expression string using the provided statements results.
static private array
getBitwiseTranslationsMap()
No description
static array
parseExpression(string $expression)
Parses the validation expression by extracting the validations into an array of checks.
static array
parseRule(string $statement, array $casts)
Parses the rule statement by extracting rule name and rule arguments.