Ejemplo n.º 1
0
 /**
  * Dispatch found route with given parameters
  * 
  * @param Route $route      found route
  * @param mixed $parameters parameters for route
  *
  * @return mixed
  */
 public function dispatchRoute(Route $route, array $parameters)
 {
     $handler = $route->getHandler();
     if ($this->_isClosure($handler)) {
         $paramMap = $this->_getFunctionArgumentsNames($handler);
         $arguments = $this->_getFunctionArguments($paramMap, $parameters, $route->getParameters());
         return call_user_func_array($handler, $arguments);
     } else {
         return $this->dispatchNotFound();
     }
 }
Ejemplo n.º 2
0
 /**
  * Dispatch found route with given parameters
  * 
  * @param Route $route      found route
  * @param mixed $parameters parameters for route
  *
  * @return mixed
  */
 public function dispatchRoute(Route $route, array $parameters)
 {
     $handler = $route->getHandler();
     if (isset($handler['controler']) && isset($handler['action'])) {
         $routeParameters = $route->getParameters();
         list($controllerName, $action) = $this->_resolveControlerAction($parameters, $routeParameters, $handler);
         $paramMap = $this->_getMethodParametersNames($controllerName, $this->_actionName . $action);
         $controller = new $controllerName();
         $callparameters = $this->_getFunctionArgumentsControlers($paramMap, $parameters, $routeParameters, $handler);
         return call_user_func_array(array($controller, $this->_actionName . $action), $callparameters);
     } else {
         return $this->dispatchNotFound();
     }
 }