Conditions | 5 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 9 | public function addResult(string $attribute, Result $result): void |
|
24 | { |
||
25 | 9 | if (!$result->isValid()) { |
|
26 | 8 | $this->isValid = false; |
|
27 | } |
||
28 | |||
29 | 9 | if (!isset($this->results[$attribute])) { |
|
30 | 9 | $this->results[$attribute] = $result; |
|
31 | 9 | return; |
|
32 | } |
||
33 | |||
34 | 3 | if ($result->isValid()) { |
|
35 | 1 | return; |
|
36 | } |
||
37 | |||
38 | 2 | foreach ($result->getErrors() as $error) { |
|
39 | 2 | $this->results[$attribute]->addError($error); |
|
40 | } |
||
77 |