| 1 | <?php  | 
            ||
| 15 | trait ErrorsContainer  | 
            ||
| 16 | { | 
            ||
| 17 | /**  | 
            ||
| 18 | * @var ErrorObject[];  | 
            ||
| 19 | */  | 
            ||
| 20 | protected $errors = [];  | 
            ||
| 21 | |||
| 22 | /**  | 
            ||
| 23 | * Add error  | 
            ||
| 24 | *  | 
            ||
| 25 | * @param ErrorObject $error  | 
            ||
| 26 | */  | 
            ||
| 27 | public function addError(ErrorObject $error)  | 
            ||
| 31 | |||
| 32 | /**  | 
            ||
| 33 | * Contains any errors ?  | 
            ||
| 34 | *  | 
            ||
| 35 | * @return bool  | 
            ||
| 36 | */  | 
            ||
| 37 | 11 | public function hasErrors(): bool  | 
            |
| 41 | |||
| 42 | /**  | 
            ||
| 43 | * Get all errors  | 
            ||
| 44 | *  | 
            ||
| 45 | * @return ErrorObject[]  | 
            ||
| 46 | */  | 
            ||
| 47 | public function getErrors(): array  | 
            ||
| 51 | |||
| 52 | /**  | 
            ||
| 53 | * Cast errors to an array  | 
            ||
| 54 | *  | 
            ||
| 55 | * @return array  | 
            ||
| 56 | */  | 
            ||
| 57 | protected function errorsToArray(): array  | 
            ||
| 68 | }  |