| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 32 | 2 | public function newRouter() |
|
| 33 | { |
||
| 34 | 2 | $app = $this->getContainer()->get('app'); |
|
| 35 | |||
| 36 | /** @var Router $router */ |
||
| 37 | 2 | $router = $this->getContainer()->make( |
|
| 38 | 2 | RouterInterface::class, |
|
| 39 | [ |
||
| 40 | 2 | 'loader' => $this->getContainer()->get('routing.loader'), |
|
| 41 | 2 | 'resource' => 'routes.php', |
|
| 42 | 'options' => [ |
||
| 43 | 2 | 'cache_dir' => $app->getCachedRoutesPath(), |
|
| 44 | ] |
||
| 45 | ] |
||
| 46 | ); |
||
| 47 | |||
| 48 | 2 | $request = Request::instance(); |
|
| 49 | 2 | if ($request instanceof Request) { |
|
| 50 | 2 | $router->setContext((new RequestContext())->fromRequest($request)); |
|
| 51 | } |
||
| 52 | 2 | return $router; |
|
| 53 | } |
||
| 55 |