Total Complexity | 7 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | Class Rules |
||
6 | { |
||
7 | use Helper; |
||
8 | |||
9 | private string $action; |
||
10 | private array $form = array(); |
||
11 | |||
12 | public function __construct(string $model) |
||
15 | } |
||
16 | |||
17 | public function action(string $action): Rules |
||
18 | { |
||
19 | $this->action = $action; |
||
20 | return $this; |
||
21 | } |
||
22 | |||
23 | public function field(string $field, array $test, ?string $placeholder = null): Rules |
||
24 | { |
||
25 | if(empty($this->action)){ |
||
26 | $this->error([ 'form' => self::$err['nFoundForm'] ]); |
||
27 | return $this; |
||
28 | } |
||
29 | |||
30 | $this->form[$this->action][$field] = $test; |
||
31 | $this->form[$this->action][$field]['placeholder'] = (null !== $placeholder) ? $placeholder : $field; |
||
32 | return $this; |
||
33 | } |
||
34 | |||
35 | public function getRules(string $action): Array |
||
38 | } |
||
39 | } |
||
40 |