Completed
Push — master ( e6f9e9...ade0a3 )
by Peter
03:33
created

ExceptionListener::onKernelException()   A

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
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Event\Listener;
10
11
use AnimeDb\Bundle\CacheTimeKeeperBundle\Exception\NotModifiedException;
12
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
13
14
class ExceptionListener
15
{
16
    /**
17
     * @param GetResponseForExceptionEvent $event
18
     */
19 2
    public function onKernelException(GetResponseForExceptionEvent $event)
20
    {
21 2
        $exception = $event->getException();
22 2
        if ($exception instanceof NotModifiedException) {
23 1
            $event->setResponse($exception->getResponse());
24 1
        }
25 2
    }
26
}
27