RouteRegistrar   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 3
eloc 9
c 2
b 0
f 2
dl 0
loc 32
rs 10
ccs 11
cts 11
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A forKeys() 0 5 1
A all() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace ByTIC\Hello\Oauth\Routes;
4
5
use ByTIC\Hello\Modules\Oauth\Controllers\KeysController;
6
use Nip\Router\Route\Route;
7
use Nip\Router\RouteCollection;
8
use Nip\Router\Router;
9
10
/**
11
 * Class RouteRegistrar
12
 * @package ByTIC\Hello\Oauth\Routes
13
 */
14
class RouteRegistrar
15
{
16
    /**
17
     * @var Router
18
     */
19
    protected $router;
20
21
    /**
22
     * @var RouteCollection
23
     */
24
    protected $routes;
25
26
    /**
27
     * RouteRegistrar constructor.
28
     * @param Router $router
29
     */
30 1
    public function __construct(Router $router)
31
    {
32 1
        $this->router = $router;
33 1
        $this->routes = $this->router->getRoutes();
34 1
    }
35
36 1
    public function all()
37
    {
38 1
        $this->forKeys();
39 1
    }
40
41 1
    protected function forKeys()
42
    {
43 1
        $route = new Route("/oauth/keys", ["controller" => KeysController::class, "action" => "index"]);
0 ignored issues
show
Bug introduced by
'/oauth/keys' of type string is incompatible with the type boolean expected by parameter $map of Nip\Router\Route\Route::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

43
        $route = new Route(/** @scrutinizer ignore-type */ "/oauth/keys", ["controller" => KeysController::class, "action" => "index"]);
Loading history...
44 1
        $route->setName('oauth.keys');
45 1
        $this->routes->prependRoute($route);
46 1
    }
47
}
48