| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 25% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | final class Between implements FilterInterface |
||
| 16 | { |
||
| 17 | private string $field; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var bool|float|int|string |
||
| 21 | */ |
||
| 22 | private $firstValue; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var bool|float|int|string |
||
| 26 | */ |
||
| 27 | private $secondValue; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $field |
||
| 31 | * @param bool|float|int|string $firstValue |
||
| 32 | * @param bool|float|int|string $secondValue |
||
| 33 | */ |
||
| 34 | public function __construct(string $field, $firstValue, $secondValue) |
||
| 35 | { |
||
| 36 | $this->field = $field; |
||
| 37 | |||
| 38 | $this->validateValue($firstValue); |
||
| 39 | $this->validateValue($secondValue); |
||
| 40 | |||
| 41 | $this->firstValue = $firstValue; |
||
| 42 | $this->secondValue = $secondValue; |
||
| 43 | } |
||
| 44 | |||
| 45 | 1 | public function toArray(): array |
|
| 46 | { |
||
| 47 | 1 | return [self::getOperator(), $this->field, $this->firstValue, $this->secondValue]; |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | public static function getOperator(): string |
|
| 51 | { |
||
| 52 | 1 | return 'between'; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param mixed $value |
||
| 57 | */ |
||
| 58 | private function validateValue($value): void |
||
| 64 | )); |
||
| 65 | } |
||
| 66 | } |
||
| 67 | } |
||
| 68 |