| Conditions | 3 |
| Paths | 1 |
| Total Lines | 31 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 20 | public function register(Container $container) |
||
| 21 | { |
||
| 22 | $container->register(array( |
||
| 23 | 'Darya\Routing\Router' => function ($container) { |
||
| 24 | $config = $container->config; |
||
| 25 | |||
| 26 | $routes = $config['routes'] ?: array( |
||
| 27 | '/:controller/:action/:params' => null, |
||
| 28 | '/:controller/:params' => null, |
||
| 29 | '/:action/:params' => null, |
||
| 30 | '/' => null |
||
| 31 | ); |
||
| 32 | |||
| 33 | $projectNamespace = $config['project.namespace'] ?: 'Application'; |
||
| 34 | |||
| 35 | $defaultNamespace = "{$projectNamespace}\Controllers"; |
||
| 36 | |||
| 37 | $router = new Router($routes, array( |
||
| 38 | 'namespace' => $defaultNamespace |
||
| 39 | )); |
||
| 40 | |||
| 41 | $router->base($config['base_url']); |
||
| 42 | |||
| 43 | $router->setServiceContainer($container); |
||
| 44 | |||
| 45 | $router->setEventDispatcher($container->resolve('Darya\Events\Dispatchable')); |
||
| 46 | |||
| 47 | return $router; |
||
| 48 | } |
||
| 49 | )); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |