GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ExceptionRenderer::render()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 4.125

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 0
loc 10
ccs 3
cts 6
cp 0.5
crap 4.125
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\Controller;
4
5
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\HttpKernel\Exception\HttpException;
8
9
class ExceptionRenderer
10
{
11
    /**
12
     * @param \Exception $e
13
     * @return Response
14
     */
15 1
    public function render(\Exception $e)
16
    {
17 1
        if($e instanceof HttpException){
18 1
            return new Response($e->getMessage(), $e->getStatusCode(), $e->getHeaders());
19
        } if($e instanceof \InvalidArgumentException){
20
            return new Response($e->getMessage(), Response::HTTP_BAD_REQUEST);
21
        }else{
22
            return new Response($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
23
        }
24
    }
25
}