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
![]() |
|||
44 | 1 | $route->setName('oauth.keys'); |
|
45 | 1 | $this->routes->prependRoute($route); |
|
46 | 1 | } |
|
47 | } |
||
48 |