Example #1
0
 /**
  * Get router (override)
  * 
  * @return  \Opis\Routing\Router
  */
 protected function getRouter()
 {
     if ($this->router === null) {
         $specials = array('app' => $this->app, 'request' => $this->app->request(), 'response' => $this->app->response(), 't' => $this->app->getTranslator(), 'lang' => $this->app->getTranslator()->getLanguage(), 'view' => $this);
         $this->router = new Router($this->collection, null, $this->getFilters(), $specials);
     }
     return $this->router;
 }
Example #2
0
 /**
  * Constructor
  * 
  * @param   \Opis\Colibri\Application $app
  */
 public function __construct(Application $app)
 {
     $this->app = $app;
     $specials = array('app' => $app, 'request' => $app->request(), 'response' => $app->response(), 't' => $app->getTranslator(), 'lang' => $app->getTranslator()->getLanguage(), 'view' => $app->getViewRouter());
     parent::__construct($app->collect('Routes'), $app->collect('Dispatchers'), null, $specials);
     $this->getRouteCollection()->notFound(function ($path) use($app) {
         return new NotFound($app->view('error.404', array('path' => $path)));
     })->accessDenied(function ($path) use($app) {
         return new AccessDenied($app->view('error.403', array('path' => $path)));
     });
     $this->getRouteCollection()->setRouter($this);
 }