| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 7 | public function __construct($errorData) |
|
| 17 | { |
||
| 18 | /** @var string[] $errors */ |
||
| 19 | 7 | $errors = []; |
|
| 20 | |||
| 21 | 7 | if ($errorData instanceof FormInterface) { |
|
| 22 | /** @var FormError $error */ |
||
| 23 | 7 | foreach ($errorData->getErrors(true) as $error) { |
|
| 24 | 7 | $errors[] = $error->getMessage(); |
|
| 25 | } |
||
| 26 | } else { |
||
| 27 | $errors = (array) $errorData; |
||
| 28 | } |
||
| 29 | |||
| 30 | 7 | parent::__construct($errors, Response::HTTP_BAD_REQUEST); |
|
| 31 | 7 | } |
|
| 32 | } |
||
| 33 |