@@ -11,30 +11,30 @@ |
||
11 | 11 | |
12 | 12 | public function __construct(object $model) |
13 | 13 | { |
14 | - $this->form['model'] = ucfirst(get_class($model)); |
|
15 | - } |
|
14 | + $this->form['model'] = ucfirst(get_class($model)); |
|
15 | + } |
|
16 | 16 | |
17 | 17 | public function setAction(string $action): Rules |
18 | 18 | { |
19 | - $this->action = $action; |
|
20 | - return $this; |
|
21 | - } |
|
19 | + $this->action = $action; |
|
20 | + return $this; |
|
21 | + } |
|
22 | 22 | |
23 | 23 | public function addField(string $field, array $test): Rules |
24 | 24 | { |
25 | - if(empty($this->action)){ |
|
25 | + if(empty($this->action)){ |
|
26 | 26 | throw new Exception("Form action not registered."); |
27 | 27 | } |
28 | 28 | |
29 | - if(empty($this->form[$this->action][$field])){ |
|
29 | + if(empty($this->form[$this->action][$field])){ |
|
30 | 30 | $this->form[$this->action][$field] = $test; |
31 | 31 | } |
32 | 32 | |
33 | - return $this; |
|
34 | - } |
|
33 | + return $this; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | public function getRules(string $action): ?array |
37 | 37 | { |
38 | - return (array_key_exists($action, $this->form)) ? $this->form[$action] : null; |
|
39 | - } |
|
38 | + return (array_key_exists($action, $this->form)) ? $this->form[$action] : null; |
|
39 | + } |
|
40 | 40 | } |