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