/** * @inheritdoc */ public function generate() { $config = parent::generate(); $route['get']['{scheme}://{any}{domain}/welcome/{word:my_name}'] = ['WelcomeController', 'index']; $config['route'] = $route; return $config; }
/** * @param $request_method * @param $uri * @param $callable * * @return $this * @throws ConfigException */ public function addRoute($request_method, $uri, $callable) { if ($callable instanceof Closure) { $controller = $this->container->singleton($this->router_config->get('controller')); if (!$controller) { throw new ConfigException('Controller in router config is not valid.'); } $action = "action_{$request_method}_{$uri}"; $controller->addAction($action, $callable); $callable = [$controller, $action]; } $this->Regex->addRoute($request_method, $uri, $callable); return $this; }