| Total Complexity | 6 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class InCondition implements InConditionInterface |
||
| 16 | { |
||
| 17 | public function __construct( |
||
| 18 | private array|string|Iterator $column, |
||
| 19 | private string $operator, |
||
| 20 | private int|iterable|Iterator|QueryInterface $values |
||
| 21 | ) { |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getColumn(): array|string|Iterator |
||
| 25 | { |
||
| 26 | return $this->column; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function getOperator(): string |
||
| 30 | { |
||
| 31 | return $this->operator; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getValues(): int|iterable|Iterator|QueryInterface |
||
| 35 | { |
||
| 36 | return $this->values; |
||
| 37 | } |
||
| 38 | |||
| 39 | public static function fromArrayDefinition(string $operator, array $operands): self |
||
| 40 | { |
||
| 41 | if (!isset($operands[0], $operands[1])) { |
||
| 42 | throw new InvalidArgumentException("Operator '$operator' requires two operands."); |
||
| 43 | } |
||
| 44 | |||
| 45 | return new static($operands[0], $operator, $operands[1]); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |