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.

Application   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handleRequest() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lib;
6
7
use Lib\Routing\Router;
8
use Psr\Http\Message\RequestInterface;
9
use Psr\Http\Message\ResponseInterface;
10
11
class Application
12
{
13
    protected $router;
14
15 4
    public function __construct(Router $router = null)
16
    {
17 4
        $this->router = $router ?? new Router();
18 4
    }
19
20 4
    public function handleRequest(RequestInterface $request): ResponseInterface
21
    {
22 4
        $attributes = $this->router->route($request);
23 4
        ['controller' => $controller, 'action' => $action, 'params' => $params] = $attributes;
24
25 4
        $namespace = '\\App\\Controller\\';
26 4
        if (!class_exists($namespace.$controller)) {
27 4
            $namespace = '\\Lib\\Controller\\';
28
        }
29 4
        $class = $namespace.$controller;
30
31 4
        return (new $class())->$action($request, ...$params);
32
    }
33
}
34