| 1 | <?php |
||
| 17 | class OperatorCondition implements ConditionInterface |
||
| 18 | { |
||
| 19 | /** @var string */ |
||
| 20 | private $key; |
||
| 21 | |||
| 22 | /** @var OperatorInterface */ |
||
| 23 | private $operator; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $key Name of the value |
||
| 27 | * @param OperatorInterface $operator Operator to run |
||
| 28 | */ |
||
| 29 | 8 | public function __construct($key, OperatorInterface $operator) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | 5 | public function holdsFor(Context $context) |
|
| 47 | |||
| 48 | /** |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | 2 | public function getKey() |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @return OperatorInterface |
||
| 58 | */ |
||
| 59 | 2 | public function getOperator() |
|
| 63 | } |
If an expression can have both
false, andnullas possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.