Completed
Pull Request — master (#30)
by
unknown
06:09
created

ExceptionListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 3
dl 0
loc 14
ccs 4
cts 7
cp 0.5714
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A onKernelException() 0 11 2
1
<?php
2
3
namespace AppBundle\Exception;
4
5
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
6
7
class ExceptionListener
8
{
9 5
    public function onKernelException(GetResponseForExceptionEvent $event)
10
    {
11 5
        $exception = $event->getException();
12 5
        if (!$exception instanceof \Google_Exception) {
13 5
            return;
14
        }
15
16
        $jsonException = new JsonHttpException($exception->getCode(), $exception->getMessage());
17
18
        $event->setException($jsonException);
19
    }
20
}
21