Extract REST routes from APC cache.
Cache is generated if needed
@return array The route objects
322237
protected function getCachedRoutes()
    {
        $ttl = (int)eZINI::instance( 'rest.ini' )->variable( 'CacheSettings', 'RouteApcCacheTTL' );

        if( self::$isRouteCacheCreated === false )
        {
            $options = array( 'ttl' => $ttl );
            ezcCacheManager::createCache( self::ROUTE_CACHE_ID, self::ROUTE_CACHE_PATH, 'ezpRestCacheStorageApcCluster', $options );
            self::$isRouteCacheCreated = true;
        }

        $cache = ezcCacheManager::getCache( self::ROUTE_CACHE_ID );
        $cacheKey = self::ROUTE_CACHE_KEY . '_' . ezpRestPrefixFilterInterface::getApiProviderName();
        if( ( $prefixedRoutes = $cache->restore( $cacheKey ) ) === false )
        {
            try
            {
                $prefixedRoutes = $this->doCreateRoutes();
                $cache->store( $cacheKey, $prefixedRoutes );
            }
            catch( Exception $e )
            {
                // Sometimes APC can miss a write. No big deal, just log it.
                // Cache will be regenerated next time
                ezpRestDebug::getInstance()->log( $e->getMessage(), ezcLog::ERROR );
            }
        }

        return $prefixedRoutes;
    }
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();
    }
183138
public function getRoutingResourcesPaths()
    {
        $ds = DIRECTORY_SEPARATOR;
        $path = $this->getPath().$ds.'Resources'.$ds.'config'.$ds.'routing.yml';

        if (file_exists($path)) {
            return [$path];
        }

        return [];
    }
1037937
protected function provideAPIRoutes()
    {
        $routes = Cache::rememberForever('provideAPIRoutes', function () {
            $router = app(Router::class);
            $routes = [];
            foreach ($router->getRoutes() as $collection) {
                foreach ($collection->getRoutes() as $route) {
                    $temp = &$routes;
                    if ($routeName = $route->getName()) {
                        foreach (explode('.', $routeName) as $key) {
                            $temp = &$temp[$key];
                        }
                        $temp = preg_replace('/{(\w+)}/', ':$1', $route->uri());
                    }
                }
            }

            return $routes['api'];
        });

        JavaScript::put(['api' => $routes]);
    }
1334067
public function routes() : array
    {
        if ($this->inBuild()) {
            throw new BuildTimeVariableAccessException('Routes are not available during the build phase.');
        }
        if (empty($this->routesDef)) {
            throw new NotValidPlatformException('No routes are defined.  Are you sure you are running on Platform.sh?');
        }

        return $this->routesDef;
    }
822303
public function gatherMiddlewareStack(): array
    {
        $middlewares = $this->getMiddlewareStack();
        // If there is a parent group, we merge both middleware stacks (Route + RouteGroup).
        if ($group = $this->getParentGroup()) {
            $middlewares = array_merge($middlewares, $group->getMiddlewareStack());
        }

        return $middlewares;
    }
860969
protected function getRoutes()
    {
        $results = array();

        foreach($this->routes as $route) {
            $results[] = $this->getRouteInformation($route);
        }

        return array_filter($results);
    }
416422
public function resolve(): array
    {
        $path = $this->request->query->get('path');
        $method = $this->request->getMethod();

        $result = $this->match("/$path", $method);

        if (empty($result)) {
            $fallback = $this->settings->get('Melior.Routing.fallbackRoute');

            $result = [
                'target' => $this->settings->get("Melior.Routing.routes.$fallback.target"),
                'params' => [],
                'name' => $fallback
            ];
        }

        return $result;
    }
177996
protected function _get()
	{
		// get the apc key for the cache identifier
		$key = $this->_get_key();

		// fetch the cached data from the apc store
		$payload = apc_fetch($key);

		try
		{
			$this->unprep_contents($payload);
		}
		catch (\UnexpectedValueException $e)
		{
			return false;
		}

		return true;
	}
1049065
public function getRoutes() : array {
        $request = get_request();
        $requestMethod = $request->method();
        $requestPathParts = $request->pathParts();
        $routesIndex = $this->routesIndex;
        $routes = [];
        $this->getRoutesFromIndex($routes,$routesIndex, $requestMethod, $requestPathParts);
        return $routes;
    }
1181376
public function getDefinitionCache(): array
    {
        return [
            $this->name,
            $this->methods,
            $this->segments,
            $this->patterns,
            $this->handler,
            $this->format,
            $this->parameterNames,
        ];
    }
592661
public function getallRouting():array
    {
        $routings = array();
        $appc = $this->getMaster("Apps");
        $apps = $appc->getAllApps();

        $routingArray = array();
        $pattern = '/\s*/m';
        $replace = '';

        foreach ($apps as $one) {
            $routers = scandir(FEnv::get("framework.root") . "apps/" . $one->name . "/Routing");
            foreach ($routers as $file) {
                $scope = null;
                if ($file == "." || $file == ".." || false === strpos($file, ".merc")) {
                    continue;
                }
                if (($router = fopen((FEnv::get("framework.apps")) .
                    $one->name . "/Routing/" . $file, "r"))) {
                    $rtarray = array("activity" => "", "path" => "", "name" => "");
                    $start = 0;
                    $end = 0;
                    $croute = 0;
                    while ($listen = fgets($router, 1024)) {
                        $listen = preg_replace($pattern, $replace, $listen);

                        if ($listen === "") {
                            continue;
                        }
                        if ($listen === "route:" && $start == 0 && $end === 0) {
                            $start = 1;
                            continue;
                        } elseif ($listen === "endroute" && $start === 1 & $end === 0) {
                            $end = 1;
                            array_push($routingArray, $rtarray);
                        } elseif (($this->strlikeInArray($listen, array("activity", "path", "name")) !== false) ||
                            ($this->strlikeInArray($listen, array("activity", "path",
                                    "name", "visibility")) !== false)) {
                            $listen = explode(':', $listen);
                            $rtarray[$listen[0]] = $listen[1];
                        }

                        if ($start === 1 && $end === 1) {
                            $rtarray = array("method" => "", "path" => "", "name" => "", "visibility" => "private");
                            $start = $end = 0;
                            $croute++;
                        }
                    }
                    $newfilename = str_replace(".merc", "", $file);
                    $view = $this->generateRoute(
                        'iumio_manager_routing_manager_get_one',
                        array("filename" => $newfilename, "appname" => $one->name)
                    );
                    $remove = $this->generateRoute(
                        'iumio_manager_routing_manager_remove_one',
                        array("filename" => $newfilename, "appname" => $one->name)
                    );
                    array_push($routings, array("name" => $file, "count_route" => $croute, "app" => $one->name,
                        'view' => $view, 'remove' => $remove));
                }
            }
        }

        return ($routings);
    }
319005
public static function getAvailableOrigins()
	{
		$arrOrigins = [];

		if(!\Config::get('bypassCache'))
		{
			// Try to get the cache key from the mapper array
			if (file_exists(TL_ROOT . '/system/cache/config/origins.php'))
			{
				$arrOrigins = include TL_ROOT . '/system/cache/config/origins.php';
				return $arrOrigins;
			}
		}


		$objRootPages = \PageModel::findPublishedRootPages();

		if($objRootPages !== null)
		{
			while($objRootPages->next())
			{
				if($objRootPages->dns == '')
				{
					continue;
				}

				$strDomain = $objRootPages->useSSL ? 'https://' : 'http://';
				$strDomain .= $objRootPages->dns;
				$arrOrigins[$objRootPages->id] = $strDomain;
			}
		}

		if(!\Config::get('bypassCache'))
		{
			// Generate the page mapper file
			$objCacheFile = new \File('system/cache/config/origins.php', true);
			$objCacheFile->write(sprintf("<?php\n\nreturn %s;\n", var_export($arrOrigins, true)));
			$objCacheFile->close();
		}

		return $arrOrigins;
	}
617618
protected function getIDListFromCache() : array
    {
        $arCacheTags = $this->getCacheTagList();
        $sCacheKey = $this->getCacheKey();

        $arElementIDList  = (array) CCache::get($arCacheTags, $sCacheKey);

        return $arElementIDList;
    }
1169739
public function getRoutes() : Array {

		$return = array();
		foreach($this->routes as $route) {
			array_push($return, [$route->getPath(), $route->getMethod()]);
		}
		return $return;

	}
76954
private function fetchRoutingTableFromCache()
    {
        $this->routes = $this->cacheInterface->get('Routing_Table');

        if (empty($this->routes))
        {
            $this->routes = $this->loadRoutingTable();
        }

        if (!empty($this->routes)) {
            $this->traverseRouteListAndBuildMap();
        }

        return $this->routes;
    }
796300
public function _GetCacheParameters()
    {
        $aParams = array();
        $oShop = TdbShop::GetInstance();

        $oActiveCategory = $oShop->GetActiveCategory();
        if (!is_null($oActiveCategory)) {
            $aParams['activecategoryid'] = $oActiveCategory->id;
        }

        return $aParams;
    }