Total Complexity | 10 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait Helper |
||
6 | { |
||
7 | protected static Validator $instance; |
||
8 | protected array $data = []; |
||
9 | protected array $validators = []; |
||
10 | protected string $model = ''; |
||
11 | protected array $required = []; |
||
12 | protected array $errors = []; |
||
13 | |||
14 | private static function getInstance(): Validator |
||
18 | } |
||
19 | |||
20 | protected function error($error): void |
||
23 | } |
||
24 | |||
25 | protected function data($field = null, ?array $values = null) |
||
26 | { |
||
27 | if(null !== $values){ |
||
28 | $this->data[$field] = $values; |
||
29 | } |
||
30 | if(null !== $field){ |
||
31 | return $this->data[$field]; |
||
32 | } |
||
33 | return $this->data; |
||
34 | } |
||
35 | |||
36 | protected function validator(string $model, ?object $callback = null) |
||
42 | } |
||
43 | |||
44 | protected function model(?string $model = null): string |
||
53 |