1 | <?php |
||
11 | class Validator |
||
12 | { |
||
13 | /** |
||
14 | * @var RuleValidatorFactory |
||
15 | */ |
||
16 | private $ruleValidatorFactory; |
||
17 | |||
18 | /** |
||
19 | * @var Field[] |
||
20 | */ |
||
21 | private $fields = []; |
||
22 | |||
23 | /** |
||
24 | * @return Validator |
||
25 | */ |
||
26 | 2 | public static function build() |
|
30 | |||
31 | /** |
||
32 | * Validator constructor. |
||
33 | */ |
||
34 | 2 | public function __construct() |
|
38 | |||
39 | /** |
||
40 | * @return Field[] |
||
41 | */ |
||
42 | public function getFields(): array |
||
46 | |||
47 | /** |
||
48 | * Merges given Validator fields with already existing ones. |
||
49 | * NOTE: It does not merge single rules in fields but the fields as whole. |
||
50 | * |
||
51 | * @param Validator $validatorBuilder |
||
52 | * |
||
53 | * @return Validator |
||
54 | */ |
||
55 | public function merge(Validator $validatorBuilder): self |
||
63 | |||
64 | /** |
||
65 | * @param Field $field |
||
66 | 2 | * |
|
67 | * @return Field |
||
68 | 2 | */ |
|
69 | public function addRawField(Field $field) |
||
80 | |||
81 | /** |
||
82 | * @param string $name |
||
83 | 2 | * |
|
84 | * @return Field |
||
85 | 2 | */ |
|
86 | public function addField(string $name): Field |
||
90 | |||
91 | /** |
||
92 | * @param $data |
||
93 | 2 | * |
|
94 | * @return VerdictList |
||
95 | 2 | */ |
|
96 | public function validate($data): VerdictList |
||
120 | } |
||
121 |