1 | <?php |
||
14 | class Query implements QueryInterface { |
||
15 | |||
16 | |||
17 | /** |
||
18 | * Array of check functions |
||
19 | * As first argument accept token |
||
20 | * Return boolean |
||
21 | * |
||
22 | * @var callable[] |
||
23 | */ |
||
24 | protected $checkFunctions = []; |
||
25 | |||
26 | /** |
||
27 | * Storage of type conditions |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $type = []; |
||
32 | |||
33 | /** |
||
34 | * Storage of conditions conditions |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $value = []; |
||
39 | |||
40 | /** |
||
41 | * Storage of line conditions |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $line = []; |
||
46 | |||
47 | /** |
||
48 | * Storage of index conditions |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $index = []; |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @return static |
||
57 | */ |
||
58 | 381 | public static function create() { |
|
61 | |||
62 | |||
63 | /** |
||
64 | * @param int|array $type Array<Int>|Int |
||
65 | * @return $this |
||
66 | */ |
||
67 | 240 | public function typeIs($type) { |
|
77 | |||
78 | |||
79 | /** |
||
80 | * @param array|int $type Array<Int>|Int |
||
81 | * @return $this |
||
82 | */ |
||
83 | 3 | public function typeNot($type) { |
|
93 | |||
94 | |||
95 | /** |
||
96 | * @param array|string $value Array<String>|String |
||
97 | * @return $this |
||
98 | */ |
||
99 | 330 | public function valueIs($value) { |
|
108 | |||
109 | |||
110 | /** |
||
111 | * @param array|string $value Array<String>|String |
||
112 | * @return $this |
||
113 | */ |
||
114 | 9 | public function valueNot($value) { |
|
124 | |||
125 | |||
126 | /** |
||
127 | * @param string[]|string $regex string[] |
||
128 | * @return $this |
||
129 | */ |
||
130 | 99 | public function valueLike($regex) { |
|
154 | |||
155 | |||
156 | /** |
||
157 | * @param int|int[] $index |
||
158 | * @return $this |
||
159 | */ |
||
160 | 9 | public function indexIs($index) { |
|
170 | |||
171 | |||
172 | /** |
||
173 | * @param int|int[] $index |
||
174 | * @return $this |
||
175 | */ |
||
176 | 3 | public function indexNot($index) { |
|
185 | |||
186 | |||
187 | /** |
||
188 | * @param int|int[] $index |
||
189 | * @return $this |
||
190 | */ |
||
191 | 3 | public function indexGt($index) { |
|
201 | |||
202 | |||
203 | /** |
||
204 | * @param int|int[] $index |
||
205 | * @return $this |
||
206 | */ |
||
207 | 3 | public function indexLt($index) { |
|
216 | |||
217 | |||
218 | /** |
||
219 | * @inheritdoc |
||
220 | */ |
||
221 | 390 | public function isValid(\Funivan\PhpTokenizer\Token $token) { |
|
238 | |||
239 | |||
240 | /** |
||
241 | * @param string|int|array $value String|Int|Array<String>|Array<Int> |
||
242 | * @return array Array<String> |
||
243 | * @throws \Exception |
||
244 | */ |
||
245 | 342 | protected function prepareValues($value) { |
|
266 | |||
267 | |||
268 | /** |
||
269 | * @param array|int $value Array<Int>|Int |
||
270 | * @return array |
||
271 | * @throws \Exception |
||
272 | */ |
||
273 | 258 | protected function prepareIntValues($value) { |
|
294 | |||
295 | |||
296 | /** |
||
297 | * Under development |
||
298 | * |
||
299 | * @param callable $checkFunction |
||
300 | * @return $this |
||
301 | */ |
||
302 | 6 | public function custom(callable $checkFunction) { |
|
306 | |||
307 | } |