| Total Complexity | 10 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | trait HasErrorsTrait |
||
| 10 | { |
||
| 11 | protected $errorsByField = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @return array |
||
| 15 | */ |
||
| 16 | public function getErrors() |
||
| 17 | { |
||
| 18 | $errors = array_merge((array)$this->getMessagesType('error'), $this->getElementsErrors()); |
||
|
|
|||
| 19 | |||
| 20 | return $errors; |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return array |
||
| 25 | */ |
||
| 26 | public function getElementsErrors() |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param $message |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | public function addError($message) |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return array |
||
| 50 | */ |
||
| 51 | public function getErrorsByField(): array |
||
| 52 | { |
||
| 53 | if ($this->errorsByField === null) { |
||
| 54 | $this->generateElementsErrors(); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $this->errorsByField; |
||
| 58 | } |
||
| 59 | |||
| 60 | protected function generateElementsErrors() |
||
| 69 | } |
||
| 70 | } |
||
| 74 |