| Conditions | 6 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 4 | public function addResult( |
|
| 20 | string $attribute, |
||
| 21 | Result $result |
||
| 22 | ): void { |
||
| 23 | 4 | if ($this->hasErrors === false && $result->isValid() === false) { |
|
| 24 | 4 | $this->hasErrors = true; |
|
| 25 | } |
||
| 26 | 4 | if (!isset($this->results[$attribute])) { |
|
| 27 | 4 | $this->results[$attribute] = $result; |
|
| 28 | 4 | return; |
|
| 29 | } |
||
| 30 | 2 | if ($result->isValid()) { |
|
| 31 | 1 | return; |
|
| 32 | } |
||
| 33 | 1 | foreach ($result->getErrors() as $error) { |
|
| 34 | 1 | $this->results[$attribute]->addError($error); |
|
| 35 | } |
||
| 57 |