Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | #[AutoconfigureTag(ExceptionFormatterLocator::EXCEPTION_FORMATTERS_TAG)] |
||
16 | 1 | class ValidationFormatter implements FormatterInterface |
|
17 | { |
||
18 | 1 | public function __invoke(ValidationException $e): ContractErrorInterface |
|
19 | { |
||
20 | 1 | return new ContractError( |
|
21 | 1 | $e->getMessage(), |
|
22 | 1 | Response::HTTP_UNPROCESSABLE_ENTITY, |
|
23 | 1 | self::formatErrors(...$e->getErrors()), |
|
24 | 1 | $e->getTrace() |
|
25 | ); |
||
26 | } |
||
27 | |||
28 | 1 | public static function getExceptionClass(): string |
|
31 | } |
||
32 | |||
33 | 1 | public static function getPriority(): int |
|
34 | { |
||
35 | 1 | return 1; |
|
36 | } |
||
37 | |||
38 | 1 | private static function formatErrors(Error ...$errors): array |
|
42 | ); |
||
43 | } |
||
44 | } |
||
45 |