class ExprBuilder
This class builds an if expression.
Properties
$ifPart | |||
$thenPart |
Methods
__construct(NodeDefinition $node) Constructor. | ||
ExprBuilder | always(Closure $then = null) Marks the expression as being always used. | |
ExprBuilder | ifTrue(Closure $closure = null) Sets a closure to use as tests. | |
ExprBuilder | ifString() Tests if the value is a string. | |
ExprBuilder | ifNull() Tests if the value is null. | |
ExprBuilder | ifArray() Tests if the value is an array. | |
ExprBuilder | ifInArray(array $array) Tests if the value is in an array. | |
ExprBuilder | ifNotInArray(array $array) Tests if the value is not in an array. | |
ExprBuilder | then(Closure $closure) Sets the closure to run if the test pass. | |
ExprBuilder | thenEmptyArray() Sets a closure returning an empty array. | |
ExprBuilder | thenInvalid(string $message) Sets a closure marking the value as invalid at validation time. | |
ExprBuilder | thenUnset() Sets a closure unsetting this key of the array at validation time. | |
NodeDefinition | end() Returns the related node. | |
static array | buildExpressions(array $expressions) Builds the expressions. |
Details
__construct(NodeDefinition $node)
Constructor.
ExprBuilder always(Closure $then = null)
Marks the expression as being always used.
ExprBuilder ifTrue(Closure $closure = null)
Sets a closure to use as tests.
The default one tests if the value is true.
ExprBuilder ifString()
Tests if the value is a string.
ExprBuilder ifNull()
Tests if the value is null.
ExprBuilder ifArray()
Tests if the value is an array.
ExprBuilder ifInArray(array $array)
Tests if the value is in an array.
ExprBuilder ifNotInArray(array $array)
Tests if the value is not in an array.
ExprBuilder then(Closure $closure)
Sets the closure to run if the test pass.
ExprBuilder thenEmptyArray()
Sets a closure returning an empty array.
ExprBuilder thenInvalid(string $message)
Sets a closure marking the value as invalid at validation time.
if you want to add the value of the node in your message just use a %s placeholder.
ExprBuilder thenUnset()
Sets a closure unsetting this key of the array at validation time.
NodeDefinition end()
Returns the related node.
static array buildExpressions(array $expressions)
Builds the expressions.
Please login to continue.