| Conditions | 3 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 6 | public function onKernelException(ExceptionEvent $event): void |
|
| 27 | { |
||
| 28 | 6 | $request = $event->getRequest(); |
|
| 29 | 6 | $isContentTypeAllowed = $request->headers->contains(Header::CONTENT_TYPE, self::ALLOWED_CONTENT_TYPE); |
|
| 30 | 6 | $isAcceptTypeAllowed = $request->headers->contains(Header::ACCEPT, self::ALLOWED_CONTENT_TYPE); |
|
| 31 | |||
| 32 | 6 | if ($isContentTypeAllowed || $isAcceptTypeAllowed) { |
|
| 33 | 3 | $errorContract = $this->exceptionFormatter->format($event->getThrowable()); |
|
| 34 | |||
| 35 | 3 | $this->eventDispatcher->dispatch(new ListenerExceptionEvent($event, $event->getThrowable(), self::class, $errorContract)); |
|
| 36 | } |
||
| 39 |