class ExprBuilder
This class builds an if expression.
| protected | $node | ||
| $ifPart | |||
| $thenPart |
| __construct(NodeDefinition $node) | ||
| $this | always(Closure $then = null) Marks the expression as being always used. | |
| $this | ifTrue(Closure $closure = null) Sets a closure to use as tests. | |
| $this | ifString() Tests if the value is a string. | |
| $this | ifNull() Tests if the value is null. | |
| ExprBuilder | ifEmpty() Tests if the value is empty. | |
| $this | ifArray() Tests if the value is an array. | |
| $this | ifInArray(array $array) Tests if the value is in an array. | |
| $this | ifNotInArray(array $array) Tests if the value is not in an array. | |
| $this | castToArray() Transforms variables of any type into an array. | |
| $this | then(Closure $closure) Sets the closure to run if the test pass. | |
| $this | thenEmptyArray() Sets a closure returning an empty array. | |
| $this | thenInvalid(string $message) Sets a closure marking the value as invalid at validation time. | |
| $this | thenUnset() Sets a closure unsetting this key of the array at validation time. | |
| NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition | end() Returns the related node. | |
| static array | buildExpressions(array $expressions) Builds the expressions. |
| NodeDefinition | $node |
Marks the expression as being always used.
| Closure | $then |
| $this |
Sets a closure to use as tests.
The default one tests if the value is true.
| Closure | $closure |
| $this |
Tests if the value is a string.
| $this |
Tests if the value is null.
| $this |
Tests if the value is empty.
| ExprBuilder |
Tests if the value is an array.
| $this |
Tests if the value is in an array.
| array | $array |
| $this |
Tests if the value is not in an array.
| array | $array |
| $this |
Transforms variables of any type into an array.
| $this |
Sets the closure to run if the test pass.
| Closure | $closure |
| $this |
Sets a closure returning an empty array.
| $this |
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.
| string | $message |
| $this |
| InvalidArgumentException |
Sets a closure unsetting this key of the array at validation time.
| $this |
| UnsetKeyException |
Returns the related node.
| NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition |
| RuntimeException |
Builds the expressions.
| array | $expressions | An array of ExprBuilder instances to build |
| array |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Config/Definition/Builder/ExprBuilder.html