| Total Complexity | 6 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | class ErrorResponseNormalizer extends AbstractErrorNormalizer implements CacheableSupportsMethodInterface |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | */ |
||
| 22 | public function normalize($object, string $format = null, array $context = []): array |
||
| 23 | { |
||
| 24 | if (!$object instanceof FlattenException) { |
||
| 25 | throw new InvalidArgumentException(sprintf('The object must implement "%s".', FlattenException::class)); |
||
| 26 | } |
||
| 27 | $context += $this->defaultContext; |
||
| 28 | $debug = $this->debug && ($context['debug'] ?? true); |
||
| 29 | |||
| 30 | return $this->createResponse($debug, $object, $context); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | * |
||
| 36 | * @param array $context |
||
| 37 | */ |
||
| 38 | public function supportsNormalization($data, string $format = null, array $context = []): bool |
||
| 41 | } |
||
| 42 | |||
| 43 | public function hasCacheableSupportsMethod(): bool |
||
| 48 |