Conditions | 5 |
Paths | 8 |
Total Lines | 23 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5.025 |
Changes | 0 |
1 | <?php |
||
56 | 1 | public function run($break_when_error = false) : bool |
|
57 | { |
||
58 | /** @var Field $field */ |
||
59 | 1 | foreach ($this->fields as $field) { |
|
60 | 1 | if (!$field->isValid($this->language)) { |
|
61 | 1 | $this->status = false; |
|
62 | 1 | $this->errors[$field->getName()] = $field->getErrors(); |
|
63 | |||
64 | /** |
||
65 | * break when there is any field error |
||
66 | */ |
||
67 | 1 | if ($break_when_error) { |
|
68 | 1 | break; |
|
69 | } |
||
70 | } |
||
71 | } |
||
72 | |||
73 | 1 | if (empty($this->errors)) { |
|
74 | $this->status = true; |
||
75 | } |
||
76 | |||
77 | 1 | return $this->status; |
|
78 | } |
||
79 | |||
108 | } |