protected function initRouter()
{
$this->di->setShared('router', function () {
/**
* @var DiInterface $this
* @var \Phalcon\Mvc\Router $router
*/
$em = $this->getShared('eventsManager');
$router = (include BASE_DIR . 'app/config/routes.php');
if (!isset($_GET['_url'])) {
$router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI);
}
$router->removeExtraSlashes(true);
$router->setEventsManager($em);
$router->setDefaultNamespace('\\Phosphorum\\Controllers');
$router->notFound(['controller' => 'error', 'action' => 'route404']);
return $router;
});
}