Get available and assigned routes

@return array
179837
public function getAvailableAndAssignedRoutes(): array
    {
        $routes = $this->getAppRoutes();
        $exists = [];

        foreach (array_keys($this->manager->getPermissions()) as $name) {
            if ($name[0] !== '/') {
                continue;
            }
            $exists[] = $name;
            unset($routes[$name]);
        }

        return [
            'available' => array_keys($routes),
            'assigned' => $exists,
        ];
    }
507127
public static function getRouteInfo()
    {
        $action 				= \Route::current()->getActionName();
        list($class, $method) 	= explode('@', $action);
        return ['controller_name' => ltrim($class, '\\'), 'method_name' => $method];
    }
1138582
public function getListRoute()
    {
        if (null === $this->listRoute) {
            $route = rtrim($this->getBaseRoute(), '/') . '/' . $this->getListSuffix();
            $this->setListRoute($route);
        }

        return $this->listRoute;
    }
767017
public function loadRoutes()
    {
        $routesJsonFile = $this->configDir . '/routes.json';
        $routesPhpFile = $this->configDir . '/routes.php';
        
        if (file_exists($this->resourcesDir) && file_exists($this->configDir)) {
            if (file_exists($routesJsonFile))
                return json_decode(file_get_contents($routesJsonFile), true);
            elseif (file_exists($routesPhpFile))
                return require_once $routesPhpFile;
        } else {
            return array();
        }
    }
1146575
private function fetchRouteRules()
    {

        # User defined routes.
        $this->route_config = require_once ROOT . 'config' . DSC . 'routes.php';

        # Route placeholder and their regex.
        $regex = array(
            '(:string)' => "([a-zA-Z0-9-_.]+)",
            '(:int)' => "([0-9]+)"
        );

        # Iterate over and preparing regex route rules.
        foreach ($this->route_config['rule'] as $rule => $value)
        {
            $new_rule = array();
            foreach (explode('/', $rule) as $split)
            {
                if (array_key_exists($split, $regex))
                {
                    $new_rule[] = str_replace($split, $regex[$split], $split);
                }
                else
                {
                    $new_rule[] = preg_quote($split);
                }
            }
            $this->route_rules[implode(preg_quote('/'), $new_rule)] = $value;
        }
    }
681638
private function getRouteFolders()
    {
        $rotas = \Config\Config::getViewPermissoes();
        $libsPath[] = [DOMINIO => "public/{$this->directory}"];
        if (!empty($_SESSION['userlogin'])) {
            $libsPath[][DOMINIO] = "public/{$this->directory}/{$_SESSION['userlogin']['setor']}";
            $libsPath = array_merge($libsPath, array_map(function ($class) {
                return [$class => VENDOR . $class . "/public/{$this->directory}/{$_SESSION['userlogin']['setor']}"];
            }, $rotas));
        }
        $libsPath = array_merge($libsPath, array_map(function ($class) {
            return [$class => VENDOR . $class . "/public/{$this->directory}"];
        }, $rotas));

        return $libsPath;
    }
390848
public function getRoutes(): array
    {
        $routes = [];
        $this->each(function (Route $route) use (&$routes) {
            $routes[] = $route;
        });

        return $routes;
    }
480068
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
186687
public function frontendRoutes()
    {
        $path = $this->basePath() . '/routes/frontend';
        if($this->isActive() && file_exists($path)) {
            return File::files($path);
        }
        return [];
    }
621536
protected function getRoutes()
    {
        $c = parent::ROUTE_PATTERN_CONTROLLER;
        $a = parent::ROUTE_PATTERN_ACTION;
        $v1 = self::ROUTE_PATTERN_VERSION_ONE;
        $v2 = self::ROUTE_PATTERN_VERSION_TWO;
        $v3 = self::ROUTE_PATTERN_VERSION_THREE;
        $o = self::ROUTE_PATTERN_OBJECT_ID;
        return array(
            "/$v1/$c" => self::MATCHES_CONTROLLER,
            "/$v1/$c/" => self::MATCHES_CONTROLLER,
            "/$v2/$c" => self::MATCHES_CONTROLLER,
            "/$v2/$c/" => self::MATCHES_CONTROLLER,
            "/$v3/$c" => self::MATCHES_CONTROLLER,
            "/$v3/$c/" => self::MATCHES_CONTROLLER,
            "/$v1/$c/$a" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v1/$c/$a/" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v2/$c/$a" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v2/$c/$a/" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v3/$c/$a" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v3/$c/$a/" => self::MATCHES_CONTROLLER_AND_ACTION,
            "/$v1/$c/$o" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v1/$c/$o/" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v2/$c/$o" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v2/$c/$o/" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v3/$c/$o" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v3/$c/$o/" => self::MATCHES_CONTROLLER_AND_ID,
            "/$v1/$c/$a/$o" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v1/$c/$a/$o/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v1/$c/$o/$a" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v1/$c/$o/$a/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v2/$c/$a/$o" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v2/$c/$a/$o/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v2/$c/$o/$a" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v2/$c/$o/$a/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v3/$c/$a/$o" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v3/$c/$a/$o/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v3/$c/$o/$a" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
            "/$v3/$c/$o/$a/" => self::MATCHES_CONTROLLER_ACTION_AND_ID,
        );
    }
297325
protected function getOptions()
    {
        $namespace = $this->getAppNamespace().'Http\Controllers';

        return [
          ['namespace', null, InputOption::VALUE_OPTIONAL, 'The root namespace for the controllers.', $namespace],

          ['path', null, InputOption::VALUE_OPTIONAL, 'The path to scan.', 'Http'.DIRECTORY_SEPARATOR.'Controllers'],

          ['list', null, InputOption::VALUE_NONE, 'List all registered routes'],
        ];
    }
595362
public function get(): array
    {
        list ($generatorClass, $dispatcherClass) = $this->getGeneratorAndDispatcherClasses();

        $routesData = $this
            ->createRouter($generatorClass, $dispatcherClass)
            ->getCachedRoutes($this->addRoutes($this->createGroup()));

        $globalConfigurators = iterator_to_array($this->getGlobalContainerConfigurators(), false);
        $globalMiddleware    = iterator_to_array($this->getGlobalMiddleWareHandlers(), false);

        return [
            static::KEY_ROUTER_PARAMS                  => [
                static::KEY_ROUTER_PARAMS__GENERATOR  => $generatorClass,
                static::KEY_ROUTER_PARAMS__DISPATCHER => $dispatcherClass,
            ],
            static::KEY_ROUTES_DATA                    => $routesData,
            static::KEY_GLOBAL_CONTAINER_CONFIGURATORS => $globalConfigurators,
            static::KEY_GLOBAL_MIDDLEWARE              => $globalMiddleware,
        ];
    }
620010
private function getParameters()
    {
        $routeParameters = $this->request->attributes->get('_route_params');
        $parameters = $this->request->query->all();

        if ($routeParameters) {
            $parameters = array_merge($routeParameters, $parameters);
        }

        return $parameters;
    }
1319119
public function getList()
    {
        $routes = &gplcart_static('route.list');

        if (isset($routes)) {
            return $routes;
        }

        $routes = (array) gplcart_config_get(GC_FILE_CONFIG_ROUTE);
        $this->hook->attach('route.list', $routes, $this);
        return $routes;
    }
499633
private function getRouteRoles()
    {
        $router = $this->router;

        $cache = $this->getConfigCacheFactory()->cache(
            $this->options['cache_dir'].'/tenside_roles.php',
            function (ConfigCacheInterface $cache) use ($router) {
                $routes = $router->getRouteCollection();
                $roles  = [];
                foreach ($routes as $name => $route) {
                    if ($requiredRole = $route->getOption('required_role')) {
                        $roles[$name] = $requiredRole;
                    }
                }

                $cache->write('<?php return ' . var_export($roles, true) . ';', $routes->getResources());
            }
        );

        return require_once $cache->getPath();
    }
616093
public function getAppRoutes()
    {
        $key = __METHOD__;
//        $cache = Configs::instance()->cache;
        $cache = null;
        if ($cache === null || ($result = $cache->get($key)) === false) {
            $result = [];
            $this->getRouteRecrusive(Yii::$app, $result);
            if ($cache !== null) {
                $cache->set($key, $result, Configs::instance()->cacheDuration, new TagDependency([
                    'tags' => self::CACHE_TAG
                ]));
            }
        }

        return $result;
    }
828203
public function getRoutes()
	{
		$router_factory = new RouterFactory;
		$router = $router_factory->newInstance();

		$routes_file = $this->getAppResourcePath('config/routes.php');

		if (file_exists($routes_file)) {
			// Let the app specify it's own routes.
			include_once($routes_file);
		} else {
			// Fall back on some sensible defaults.
			$router->add(null, '/');
			$router->add(null, '/{controller}');
			$router->add(null, '/{controller}/{action}');
			$router->add(null, '/{controller}/{action}/{id}');
		}

		$this->router = $router;
	}