1 | <?php declare(strict_types=1); |
||
14 | abstract class FilterHelper |
||
15 | { |
||
16 | /** |
||
17 | * @var RecursiveParser |
||
18 | */ |
||
19 | protected static $parser; |
||
20 | |||
21 | /** |
||
22 | * Return the cached instance of RecursiveParser |
||
23 | * |
||
24 | * @return RecursiveParser |
||
25 | */ |
||
26 | 4 | public static function getParser(): RecursiveParser |
|
36 | |||
37 | /** |
||
38 | * Test whether given filter is a default filter or is in the list of allowed filters |
||
39 | * |
||
40 | * @param string $filter |
||
41 | * @param string[] $allowedFilters |
||
42 | * @return bool |
||
43 | */ |
||
44 | 6 | public static function isAllowed(string $filter, array $allowedFilters): bool |
|
55 | |||
56 | /** |
||
57 | * Parse a filter definition |
||
58 | * |
||
59 | * @param string $filterString Filter definition such as "#number" or "strtolower($attrValue)" |
||
60 | * @return array Associative array with a "filter" element and optionally a |
||
61 | * "params" array |
||
62 | */ |
||
63 | 4 | public static function parse(string $filterString): array |
|
70 | } |