ExceptionListener::onKernelException()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2014, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Event\Listener;
11
12
use AnimeDb\Bundle\CacheTimeKeeperBundle\Exception\NotModifiedException;
13
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
14
15
class ExceptionListener
16
{
17
    /**
18
     * @param GetResponseForExceptionEvent $event
19
     */
20 2
    public function onKernelException(GetResponseForExceptionEvent $event)
21
    {
22 2
        $exception = $event->getException();
23 2
        if ($exception instanceof NotModifiedException) {
24 1
            $event->setResponse($exception->getResponse());
25 1
        }
26 2
    }
27
}
28