Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
16 | 3 | public function onKernelView(GetResponseForControllerResultEvent $event): void |
|
17 | { |
||
18 | 3 | $controllerResult = $event->getControllerResult(); |
|
19 | |||
20 | 3 | if ($controllerResult instanceof Response) { |
|
21 | 1 | return; |
|
22 | } |
||
23 | |||
24 | 2 | $serializer = $this->getSerializer($event->getRequest()); |
|
25 | 2 | $body = ''; |
|
26 | 2 | if ($this->isContentAllowed($event->getRequest()->getMethod())) { |
|
27 | 2 | $body = $serializer->serialize($controllerResult); |
|
28 | } |
||
29 | |||
30 | 2 | $event->setResponse( |
|
31 | 2 | $this->createResponse( |
|
32 | 2 | $body, |
|
33 | 2 | Response::HTTP_OK, |
|
34 | 2 | $serializer->getContentType() |
|
35 | ) |
||
69 |