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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 3
cts 6
cp 0.5
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 3
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
}