예제 #1
0
파일: XML.php 프로젝트: minchal/vero
 /**
  * Fill Router with all founded Routes.
  * This method will try first to search routes in cache.
  * 
  * @return Router
  */
 public function fill(Router $router)
 {
     $lastMod = $this->getMtime();
     $data = $this->cache->fetch('routes');
     if (!$data || $data['saveTime'] < $lastMod) {
         $data['saveTime'] = time();
         $data['routes'] = $this->buildRoutes();
         $this->cache->save('routes', $data);
     }
     foreach ($data['routes'] as $id => $route) {
         $router->addRoute($id, $route);
     }
     return $router;
 }
예제 #2
0
파일: Action.php 프로젝트: minchal/vero
 /**
  * Forward request to another action.
  * 
  * @param string
  * @return mixed
  */
 public function forward($routeId, array $params = [])
 {
     $class = $this->router->getRoute($routeId)->getAction();
     $action = new $class($this->getContainer());
     return $action->run($this->get('request')->setParams($params));
 }