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 ( dbe9e8...3eb9e5 )
by Benjamin
03:26
created

DefaultController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 32
rs 10
c 0
b 0
f 0
ccs 11
cts 11
cp 1
wmc 4

4 Methods

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