| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 3 |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 14 | 12 | public function onKernelView(GetResponseForControllerResultEvent $event) |
|
| 15 | { |
||
| 16 | 12 | $result = $event->getControllerResult(); |
|
| 17 | 12 | $format = $event->getRequest()->getRequestFormat(); |
|
| 18 | |||
| 19 | 12 | if (!$result instanceof View) { |
|
| 20 | 3 | return; |
|
| 21 | } |
||
| 22 | |||
| 23 | 9 | if (!$this->supports($result, $format)) { |
|
| 24 | 4 | return; |
|
| 25 | } |
||
| 26 | |||
| 27 | 5 | $response = Response::create( |
|
| 28 | 5 | $this->getContent($result, $format), |
|
| 29 | 5 | $result->getStatusCode(), |
|
| 30 | 5 | $result->getHeaders() |
|
| 31 | 5 | ) |
|
| 32 | 5 | ->setCache($result->getCache()) |
|
| 33 | 5 | ; |
|
| 34 | |||
| 35 | 5 | $event->setResponse($response); |
|
| 36 | 5 | } |
|
| 37 | |||
| 54 |