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 | * @return GroupExpression |
||
47 | */ |
||
48 | final public function asGroup(): GroupExpression |
||
52 | |||
53 | /** |
||
54 | * @return Expression|NegatedExpression |
||
55 | */ |
||
56 | final public function negate(): Expression |
||
60 | |||
61 | /** |
||
62 | * @param $expression |
||
63 | * @param array ...$values |
||
64 | * @return Expression |
||
65 | * @throws \InvalidArgumentException |
||
66 | */ |
||
67 | final public static function where($expression, ...$values): self |
||
80 | |||
81 | /** |
||
82 | * @param $expression |
||
83 | * @param array ...$values |
||
84 | * @return GroupExpression |
||
85 | * @throws \InvalidArgumentException |
||
86 | */ |
||
87 | final public static function group($expression, ...$values): GroupExpression |
||
91 | |||
92 | /** |
||
93 | * @param $expression |
||
94 | * @param array ...$values |
||
95 | * @return NegatedExpression |
||
96 | * @throws \InvalidArgumentException |
||
97 | */ |
||
98 | final public static function not($expression, ...$values): NegatedExpression |
||
102 | |||
103 | /** |
||
104 | * @param array $values |
||
105 | * @return array |
||
106 | * @throws \InvalidArgumentException |
||
107 | */ |
||
108 | final private static function valuesFactory(array $values): array |
||
123 | |||
124 | /** |
||
125 | * @return string |
||
126 | */ |
||
127 | abstract public function __toString(): string; |
||
128 | |||
129 | /** |
||
130 | * @return array |
||
131 | */ |
||
132 | abstract public function getValues(): array; |
||
133 | |||
134 | /** |
||
135 | * @param Expression[] ...$expressions |
||
136 | * @return array |
||
137 | */ |
||
138 | final public static function valuesOf(self ...$expressions): array |
||
153 | } |
||
154 |
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: