1 | <?php |
||
5 | abstract class AbstractFilter |
||
6 | { |
||
7 | protected $recursive = true; |
||
8 | |||
9 | protected $options = []; |
||
10 | |||
11 | protected $context; |
||
12 | |||
13 | 58 | public function __construct($options = [], $recursive = true) |
|
23 | |||
24 | 58 | protected function normalizeOptions($options) |
|
44 | |||
45 | /** |
||
46 | * Generates a unique string to identify the validator. |
||
47 | * It can be used to compare 2 validators |
||
48 | * (eg: so you don't add the same validator twice in a validator object) |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 2 | public function getUniqueId(): string |
|
56 | |||
57 | /** |
||
58 | * Set an option for the validator. |
||
59 | * |
||
60 | * The options are also be passed to the error message. |
||
61 | * |
||
62 | * @param string $name |
||
63 | * @param mixed $value |
||
64 | * @return self |
||
65 | */ |
||
66 | 25 | public function setOption($name, $value) |
|
71 | |||
72 | 13 | public function setContext($context) |
|
77 | |||
78 | 42 | public function filter($value, string $valueIdentifier = null) |
|
91 | |||
92 | abstract public function filterSingle($value, string $valueIdentifier = null); |
||
93 | } |
||
94 |