MissingViewHandler::handleMissingView()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 3
1
<?php
2
3
namespace Knp\RadBundle\EventListener;
4
5
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
6
use Symfony\Component\HttpKernel\HttpKernelInterface;
7
8
class MissingViewHandler
9
{
10
    public function handleMissingView(GetResponseEvent $event, $viewName, array $viewParams = null)
11
    {
12
        $kernel = $event->getKernel();
13
        $request = $event->getRequest();
14
15
        $subRequest = $request->duplicate(array(), null, array(
16
            '_controller' => 'KnpRadBundle:Assistant:missingView',
17
            'viewName'   => $viewName,
18
            'viewParams' => $viewParams,
19
        ));
20
21
        $response = $kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
22
        $event->setResponse($response);
23
    }
24
}
25