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.
Completed
Push — master ( 84bb15...86ae46 )
by Benjamin
05:01
created

DefaultController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 76.92%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 10
cts 13
cp 0.7692
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A notFoundAction() 0 3 1
A create() 0 3 1
A render() 0 5 1
A __construct() 0 3 1
A returnResponse() 0 8 1
1
<?php
2
3
namespace Lib\Controller;
4
5
use Lib\Templating\Templater;
6
use GuzzleHttp\Psr7\Response;
7
use Psr\Http\Message\ResponseInterface;
8
9
class DefaultController
10
{
11
    /**
12
     * @var Templater
13
     */
14
    private $templater;
15
16 3
    public function __construct()
17
    {
18 3
        $this->templater = new Templater();
19 3
    }
20
21 3
    public function notFoundAction()
22
    {
23 3
        return $this->returnResponse('Not Found', 404);
24
    }
25
26 3
    public static function create()
27
    {
28 3
        return new self();
29
    }
30
31
    public function render($template, array $params): ResponseInterface
32
    {
33
        $view = $this->templater->render($template, $params);
34
35
        return $this->returnResponse($view);
36
    }
37
38 3
    public function returnResponse($body = '', $statusCode = 200): ResponseInterface
39
    {
40
        $headers = [
41 3
            'Content-Type' => ['text/html; charset=UTF-8'],
42
            'Cache-Control' => ['max-age=172800', 'public']
43
        ];
44
45 3
        return new Response($statusCode, $headers, $body);
46
    }
47
}
48