Register every valid route defined in $route_config array.

@param mixed      $default_controller used as default controller if a route comes without any specific controller
@param array|null $route_config
978654
public function registerRoutes($default_controller, array $route_config)
    {
        foreach ($route_config as $name => &$route) {
            if (false === isset($route['defaults']) || false === isset($route['defaults']['_action'])) {
                $this->getApplication()->warning("Unable to parse the action method for the route `$name`.");
                continue;
            }

            if (false === array_key_exists('_controller', $route['defaults'])) {
                $route['defaults']['_controller'] = $default_controller;
            }

            if (false === is_string($route['defaults']['_controller'])) {
                throw new FrontControllerException(
                    'Route controller must be type of string. '
                    .'Please provide controller namespace or controller service id instead of '
                    .'instance of `'.get_class($route['defaults']['_controller']).'`.'
                );
            }
        }

        $router = $this->getRouteCollection();
        $router->pushRouteCollection($route_config);
    }
42060
protected function registerController()
    {
        $config = $this->app['config'];

        $recipes    = $config->get('jitimage::recipes', []);
        $route      = $config->get('jitimage::route', 'image');
        $cacheroute = $config->get('jitimage::cache.route', 'jit/storage');

        $this->registerCacheRoute($cacheroute);

        if (false === $this->registerStaticRoutes($recipes, $route)) {
            $this->registerDynanmicRoute($route);
        }
    }
809919
public static function buildRoutes($routeConfig, $app = null)
    {
        $app = empty($app) ? Yii::$app : $app;
        $rules = static::collectRoutes($routeConfig, $app);
        $app->urlManager->addRules($rules, $routeConfig['append']);
    }
937799
protected function registerRoutes()
    {
        $this->app['router']->group([
            'middleware' => config('bone.captcha.middleware', 'web'),
            'namespace'  => 'Igoshev\Captcha\Controllers',
            'as'         => 'bone.captcha.'
        ], function ($router) {
            $router->get(config('bone.captcha.routes.image'), 'CaptchaController@image')->name('image');
            $router->get(config('bone.captcha.routes.image_tag'), 'CaptchaController@imageTag')->name('image.tag');
        });
    }
713862
protected function registerRoutes()
    {
        $this->get($this['imagine.thumbnail_url'] . '{size}/{checksum}/{path}', function (Application $app, Request $request, $path, $size, $checksum) { return $app['controllers.imagine']->resizeImageAction($request, $path, $size, $checksum); })->assert('path', '.+');
        $this->get('', function (Application $app, Request $request) { return $app['controllers.page']->showHomePageAction($request); });
        $this->error(function (NotFoundHttpException $e, $code) { return $this['controllers.error']->notFoundAction($e); });
        $this->error(function (\Exception $e, $code) { return $this['controllers.error']->internalServerErrorAction($e); });
    }
276998
public function config(array $config): void
    {
        if ($this->routeCounter > 0) {
            throw new \LogicException('Routing has been added, and configuration is not allowed!');
        }

        $props = [
            'name'                   => 1,
            'chains'                 => 1,
            // 'defaultRoute'           => 1,
            'ignoreLastSlash'        => 1,
            'tmpCacheNumber'         => 1,
            'handleMethodNotAllowed' => 1,
            'autoRoute'              => 1,
            'controllerNamespace'    => 1,
            'controllerSuffix'       => 1,
        ];

        foreach ($config as $name => $value) {
            if (isset($props[$name])) {
                $this->$name = $value;
            }
        }
    }
464164
protected function loadController() {
		//try to load the controller
		$config = $this->getConfig();
		$controller = null;
		if (!empty($config['controllerConfig']['name'])) {
			$className = $this->getSite()->getControllerClass($config['controllerConfig']['name']);
			if (class_exists($className)) {
				$controller = new $className($this->getSite(),$config['controllerConfig']);
				$controller->evaluate();
			}
		}
		if (!$controller) {
			$this->logger->warn("Did not find Controller Class");
			$this->getSite()->setRedirectUrl($config['PATH_HTTP']);
		}
	}
132147
public function controller($route, $settings, $controller = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        if (is_null($controller)) {
            $controller = $settings;
            $settings = [];
        }

        $controller = str_replace(['\\', '.'], '/', $controller);
        $controllerFile = realpath(
            rtrim($this->paths['controllers'], '/') . '/' . $controller . '.php'
        );

        if (! file_exists($controllerFile)) {
            return $this->exception($controller . ' class is not found!');
        }

        if (! class_exists($controller)) {
            require $controllerFile;
        }

        $controller = str_replace('/', '\\', $controller);
        $classMethods = get_class_methods($this->namespaces['controllers'] . $controller);
        if ($classMethods) {
            foreach ($classMethods as $methodName) {
                if(!strstr($methodName, '__')) {
                    $method = "any";
                    foreach(explode('|', RouterRequest::$validMethods) as $m) {
                        if(stripos($methodName, strtolower($m), 0) === 0) {
                            $method = strtolower($m);
                            break;
                        }
                    }

                    $methodVar = lcfirst(str_replace($method, '', $methodName));
                    $r = new ReflectionMethod($this->namespaces['controllers'] . $controller, $methodName);
                    $reqiredParam = $r->getNumberOfRequiredParameters();
                    $totalParam = $r->getNumberOfParameters();

                    $value = ($methodVar === $this->mainMethod ? $route : $route.'/'.$methodVar);
                    $this->{$method}(
                        ($value.str_repeat('/{a}', $reqiredParam).str_repeat('/{a?}', $totalParam-$reqiredParam)),
                        $settings,
                        ($controller . '@' . $methodName)
                    );
                }
            }
            unset($r);
        }

        return true;
    }
585262
protected function loadRoutesFromConfig() {
        $config = $this->config->getRaw('routing', []);
        $this->routerConfigurator->processConfig($this->router, $config);
    }
112167
public function connect($url, $name, $controller=null)
	{
		$this->_router->connect($url, $name, $controller);

		// register the controller if one is provided
		if(!is_null($controller))
		{
			$this->_controllers[$name] = $controller;
		}

		return $this;
	}
351014
public function startup($controller = null)
    {
        if (!$controller) {
            $controller = new Controller(new Request());
        }
        $registry = new ComponentRegistry();
        $this->Acl = new AclComponent($registry, Configure::read('Acl'));
        $this->Aco = $this->Acl->Aco;
        $this->controller = $controller;
        $this->_buildPrefixes();
        $this->_processIgnored();
    }
312126
protected function registerInspected($route, $controller, $method, &$names)
    {
        $action = ['uses' => $controller . '@' . $method];
        
        // If a given controller method has been named, we will assign the name to the
        // controller action array, which provides for a short-cut to method naming
        // so you don't have to define an individual route for these controllers.
        $action['as'] = array_get($names, $method);
        $this->{$route['verb']}($route['uri'], $action);
    }
1152878
public function addDefaults(array $defaults)
    {
        if ($defaults) {
            foreach ($this->routes as $route) {
                $route->addDefaults($defaults);
            }
        }
    }
496061
public function initialize(Controller $controller) {
		if ($this->settings['isTest']) {
			return;
		}

		$this->user = $this->Session->read("{$this->settings['path']}");

		$this->routes = Permit::$routes;
		Permit::$user = $this->user;

		$this->request = $controller->request;

		foreach (array('controller', 'plugin') as $inflected) {
			if (isset($this->request->params[$inflected])) {
				$this->request->params[$inflected] = strtolower(Inflector::underscore($this->request->params[$inflected]));
			}
		}
	}
707928
protected function setCurrentController()
    {
        $action = substr(basename(Route::currentRouteAction()), 0, strpos(basename(Route::currentRouteAction()), '@'));

        $this->currentController = Str::snake(Str::replaceLast('Controller', '', $action));
    }
1328682
public static function collectRoutes($routeConfig, $app = null)
    {
        $app = empty($app) ? Yii::$app : $app;
        $rules = [];
        if (isset($routeConfig['urlPrefix']) && $routeConfig['urlPrefix'] !== false && is_file($routeConfig['fileRoutes'])) {
            //!! config file use var $routeConfig:
            $routes = include($routeConfig['fileRoutes']);
            if (empty($routes)) return [];

            switch ($routeConfig['class']) {
                case GroupUrlRule::className(): // only for this class config-routes-files very simple
                    $configGroupRules = [
                        'rules'  => $routes,
                        'prefix' => $routeConfig['urlPrefix'],
                        'routePrefix' => $routeConfig['moduleUid'],
                    ];
                    $rules = [new GroupUrlRule($configGroupRules)];
                    break;
                default: // universal
                    if (isset($routes['enablePrettyUrl'])) {
                        $app->urlManager->enablePrettyUrl = $routes['enablePrettyUrl'];
                        unset($routes['enablePrettyUrl']);
                    }
                    $rules = $routes;
                    break;
            }
        }
        return $rules;
    }
1251853
protected function _set_default_controller()
    {
        // controller in APPPATH/controllers takes priority over module with same name
        parent::_set_default_controller();

        // see if parent found a controller
        $class = $this->fetch_class();

        if (empty($class)) {

            // no 'normal' controller found,
            // get the class/method from the default_controller route
            if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2) {
                $method = 'index';
            }

            // try to locate default controller in modules
            if ($located = $this->locate([$class, $class, $method])) {
                log_message('debug', 'No URI present. Default module controller set.');
            }
        }

        // Nothing found - this will trigger 404 later
    }