1 | <?php |
||
6 | abstract class Expression |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * @param $expression |
||
11 | * @param array ...$values |
||
12 | * @return CompositeExpression |
||
13 | * @throws \InvalidArgumentException |
||
14 | */ |
||
15 | final public function and($expression, ...$values): CompositeExpression |
||
20 | |||
21 | /** |
||
22 | * @param $expression |
||
23 | * @param array ...$values |
||
24 | * @return CompositeExpression |
||
25 | * @throws \InvalidArgumentException |
||
26 | */ |
||
27 | final public function or($expression, ...$values): CompositeExpression |
||
32 | |||
33 | /** |
||
34 | * @param $expression |
||
35 | * @param array ...$values |
||
36 | * @return CompositeExpression |
||
37 | * @throws \InvalidArgumentException |
||
38 | */ |
||
39 | final public function plus($expression, ...$values): CompositeExpression |
||
44 | |||
45 | /** |
||
46 | * @param $expression |
||
47 | * @param array ...$values |
||
48 | * @return CompositeExpression |
||
49 | * @throws \InvalidArgumentException |
||
50 | */ |
||
51 | final public function as($expression, ...$values): CompositeExpression |
||
56 | |||
57 | /** |
||
58 | * @return GroupExpression |
||
59 | */ |
||
60 | final public function asGroup(): GroupExpression |
||
64 | |||
65 | /** |
||
66 | * @return Expression|NegatedExpression |
||
67 | */ |
||
68 | final public function negate(): Expression |
||
72 | |||
73 | /** |
||
74 | * @param $expression |
||
75 | * @param array ...$values |
||
76 | * @return Expression |
||
77 | * @throws \InvalidArgumentException |
||
78 | */ |
||
79 | final public static function where($expression, ...$values): self |
||
92 | |||
93 | /** |
||
94 | * @param $expression |
||
95 | * @param array ...$values |
||
96 | * @return GroupExpression |
||
97 | * @throws \InvalidArgumentException |
||
98 | */ |
||
99 | final public static function group($expression, ...$values): GroupExpression |
||
103 | |||
104 | /** |
||
105 | * @param $expression |
||
106 | * @param array ...$values |
||
107 | * @return NegatedExpression |
||
108 | * @throws \InvalidArgumentException |
||
109 | */ |
||
110 | final public static function not($expression, ...$values): NegatedExpression |
||
114 | |||
115 | /** |
||
116 | * @param array $values |
||
117 | * @return array |
||
118 | * @throws \InvalidArgumentException |
||
119 | */ |
||
120 | final private static function valuesFactory(array $values): array |
||
135 | |||
136 | /** |
||
137 | * @return string |
||
138 | */ |
||
139 | abstract public function __toString(): string; |
||
140 | |||
141 | /** |
||
142 | * @return array |
||
143 | */ |
||
144 | abstract public function getValues(): array; |
||
145 | |||
146 | /** |
||
147 | * @param Expression[] ...$expressions |
||
148 | * @return array |
||
149 | */ |
||
150 | final public static function valuesOf(self ...$expressions): array |
||
165 | } |
||
166 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: