/** * Constructor. * * @param DF_Web_Routing_Config_Action $config * @return DF_Web_Routing_Action */ public function __construct($config) { if (!$config instanceof DF_Web_Routing_Config_Action) { throw new DF_Error_InvalidArgumentException("config", $config, DF_Web_Routing_Config_Action); } $ctrl = $config->get_controller(); $this->controller_name = $ctrl->get_name(); $this->controller_path = $ctrl->get_path(); $this->name = $config->get_name(); $this->path = $config->get_path(); $this->args = $this->prepare_args($config); $this->init_local($config); }
/** * * @param DF_Web_Routing_Config_Action $config * @return DF_Web_Path */ protected function prepare_path($config) { $stars = array(); $captures = $this->captures; for ($i = 0; $i < $captures->get_numargs(); $i++) { $stars[] = "*"; } $argspath = join("/", $stars); $path = $config->get_path(); #if (!$path->is_absolute()) { # $controller = new DF_Web_Path("/".$this->controller->get_path()); # $path = $controller->append_path($path); #} if ($argspath) { $path = $path->append_path(DF_Web_Path::fromString($argspath)); } return $path; }