| Conditions | 6 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | private static function validateCondition(string $operator, array $condition): ExpressionInterface|array|null|string |
||
| 37 | { |
||
| 38 | if (count($condition) !== 1) { |
||
| 39 | throw new InvalidArgumentException("Operator '$operator' requires exactly one operand."); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** @var mixed $condition */ |
||
| 43 | $condition = array_shift($condition); |
||
| 44 | |||
| 45 | if ( |
||
| 46 | !is_array($condition) && |
||
| 47 | !($condition instanceof ExpressionInterface) && |
||
| 48 | !is_string($condition) && |
||
| 49 | $condition !== null |
||
| 50 | ) { |
||
| 51 | throw new InvalidArgumentException( |
||
| 52 | "Operator '$operator' requires condition to be array, string, null or ExpressionInterface." |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | |||
| 56 | return $condition; |
||
| 57 | } |
||
| 59 |