1 | <?php |
||
18 | class Where extends Criterion |
||
19 | { |
||
20 | /** |
||
21 | * @var Operator |
||
22 | */ |
||
23 | private $operator; |
||
24 | |||
25 | /** |
||
26 | * @var mixed |
||
27 | */ |
||
28 | private $value; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $and; |
||
34 | |||
35 | /** |
||
36 | * Where constructor. |
||
37 | * @param string $field |
||
38 | * @param string $operator |
||
39 | * @param mixed $value |
||
40 | * @param bool $and |
||
41 | */ |
||
42 | 35 | public function __construct(string $field, string $operator, $value, bool $and = true) |
|
50 | |||
51 | /** |
||
52 | * @param mixed $value |
||
53 | * @return array|mixed |
||
54 | */ |
||
55 | 35 | private function normalizeValue($value) |
|
70 | |||
71 | /** |
||
72 | * @param Operator $operator |
||
73 | * @param mixed $value |
||
74 | * @return Operator |
||
75 | */ |
||
76 | 35 | private function normalizeOperator(Operator $operator, $value): Operator |
|
88 | |||
89 | /** |
||
90 | * @param mixed $operator |
||
91 | * @param null $value |
||
92 | * @return array |
||
93 | */ |
||
94 | 25 | public static function completeMissingParameters($operator, $value = null): array |
|
102 | |||
103 | /** |
||
104 | * @return Operator |
||
105 | */ |
||
106 | 35 | public function getOperator(): Operator |
|
110 | |||
111 | /** |
||
112 | * @return mixed |
||
113 | */ |
||
114 | 35 | public function getValue() |
|
118 | |||
119 | /** |
||
120 | * @return bool |
||
121 | */ |
||
122 | 35 | public function isAnd(): bool |
|
126 | } |
||
127 |