| 1 | <?php |
||
| 13 | trait ErrorContainerTrait |
||
| 14 | { |
||
| 15 | |||
| 16 | /** @var \Exception[] */ |
||
| 17 | protected $errors = []; |
||
| 18 | |||
| 19 | 29 | public function addError(\Exception $exception) |
|
| 20 | { |
||
| 21 | 29 | $this->errors[] = $exception; |
|
| 22 | |||
| 23 | 29 | return $this; |
|
| 24 | } |
||
| 25 | |||
| 26 | 100 | public function hasErrors() |
|
| 27 | { |
||
| 28 | 100 | return !empty($this->errors); |
|
| 29 | } |
||
| 30 | |||
| 31 | 2 | public function getErrors() |
|
| 32 | { |
||
| 33 | 2 | return $this->errors; |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | public function mergeErrors(ErrorContainerInterface $errorContainer) |
|
| 46 | |||
| 47 | 28 | public function getErrorsArray($inGraphQLStyle = true) |
|
| 48 | { |
||
| 49 | 28 | $errors = []; |
|
| 72 | |||
| 73 | 6 | public function clearErrors() |
|
| 79 | |||
| 80 | } |