dump

@param RouteCollectionInterface $routes

@return string
559189
public function dump(RouteCollectionInterface $routes)
    {
        $map = $this->createMap($routes);

        return sprintf("<?php\n\nreturn %s;", $this->extractParams($map));
    }
965757
public function dump() {
        $schema = array();

        foreach(Cache::get('app_collections') as $collection) {
            $schema[$collection] = Cache::get($collection);
        }

        return $schema;
    }
1249338
public String generateJSON(Collection<Route> routes) {
        Swagger swagger = build(routes);
        String json = Json.pretty(swagger);
        return json;
    }
260231
public function handle(RouteInterface $route)
    {
        $params = [];

        // create the regex that matches paths against the route
        $patternRegex = $this->createRouteRegex($route, $route->getPattern(), $params);

        // if the route regex matches the current request path
        if (preg_match($patternRegex, $route->getRoute(), $matches)) {
            if (count($matches) > 1) {
                // remove the first match (which is the full route match)
                array_shift($matches);

                // use the extracted parameters as the arguments' keys and the matches as the arguments' values
                return array_combine($params, $matches);
            } else {
                return [];
            }
        }
        // if the route regex does not match the current request path returns null
    }
1250041
protected function getRouteActions($routes)
    {
        $actions = array();

        // iterate for all routes
        foreach ($routes->all() as $route){

            // if route is post and is direct exposed
            if (in_array('POST', $route->getMethods()) == true && $route->isDirect()){
                $apiParts = $this->getRouteApiParts($route);

                if ($apiParts['exposed']){
                    $path = $apiParts['path'];
                    unset($apiParts['path']);
                    unset($apiParts['exposed']);

                    $actions[$path][] = $apiParts;
                }
            }

        }

        return $actions;
    }
192071
public function printUrl($route)
    {
        if (empty($route)) {
            return '';
        }

        try {
            $url = $this
                ->urlGenerator
                ->generate($route);
        } catch (ExceptionInterface $e) {
            $url = (string) $route;
        }

        return $url;
    }
35979
protected function convertObjectsToHashes(array $routeValues)
    {
        foreach ($routeValues as &$value) {
            if (is_object($value)) {
                if ($value instanceof CacheAwareInterface) {
                    $identifier = $value->getCacheEntryIdentifier();
                } else {
                    $identifier = $this->persistenceManager->getIdentifierByObject($value);
                }
                if ($identifier === null) {
                    return null;
                }
                $value = $identifier;
            } elseif (is_array($value)) {
                $value = $this->convertObjectsToHashes($value);
                if ($value === null) {
                    return null;
                }
            }
        }
        return $routeValues;
    }
656765
private function getPathPrefix(RouteInterface $route, $host = null)
    {
        $context = $route->getContext();

        if (null === $host) {
            $host = $route->getHost() ? $route->getHost() : $this->request->getHost();
        }

        if (null !== $route->getHost() && !(bool)preg_match($context->getHostRegex(), $host)) {
            throw new \InvalidArgumentException('Host requirement does not match given host.');
        }

        return sprintf('%s://%s', $this->getRouteProtocol($route, $this->getRequest()), $host);
    }
1069140
private function getHypertextJson($routes = [])
    {
        if (!$routes) {
            return false;
        }
        $links = [];
        foreach ($routes as $name => $route) {
            $links[] = ['rel' => $name, 'href' => $route];
        }
        return $links;
    }
1181886
public function populateCollection(RouteCollection $routes): RouteCollection
    {
        foreach ($this->items as $route) {
            if ($route instanceof self) {
                $route->populateCollection($routes);
            } else {
                $routes->add(...$route);
            }
        }

        return $routes;
    }
1364944
private function filterByMethodAndScheme(RouteCollectionInterface $routes, Request $context)
    {
        return $routes->findByMethod($context->getMethod())->findByScheme($context->getScheme());
    }
354428
public function dump(ServerInterface $server, $spaces = 0)
    {
        $config = '';

        foreach ($this->directives as $directive) {
            $config .= $directive->dump($server, $spaces + ($this->isMainContext() ? 0 : 4));
        }

        return $this->dumpBlock($server->getDumperStartDirective(), $spaces).
            $config.
            $this->dumpBlock($server->getDumperEndDirective(), $spaces);
    }
198518
public static function generate(RouteCollection $routeCollection, $routeName)
    {
        $flag = false;
        $index = 1;
        while ($flag === false) {
            if ($routeCollection->get($routeName)) {
                $routeName = $routeName.'_'.$index++;
            } else {
                $flag = true;
            }
        }

        return $routeName;
    }
614847
public function export(RouteCollection $routes)
    {
        // Create the output directory.
        if (!is_dir($this->outputDir)) {
            mkdir($this->outputDir, 0777, true);
        }

        // Check if it is writable.
        if (!is_writable($this->outputDir)) {
            throw new \InvalidArgumentException(sprintf('The output directory "%s" is not writable.', $this->outputDir));
        }

        $this->exportRoutes($routes);
    }
1125003
public function softIncrement($route, array $routes)
    {

        // flat the route array
        $flatten = array_map(function($route) {
            return $route->getRoute();
        }, $routes);

        $i = 0;

        array_walk($routes, function($_route) use($route, &$i) {

            $search = "#".addcslashes(preg_replace('/\([0-9]+\)*$/', "", $route),'()').'(\([0-9]+\))*$#';

            if(preg_match($search, $_route->getRoute(), $matches)) {
                if(count($matches) == 2) {
                    $i = (int)$matches[1] == $i ? (int)$matches[1] + 1 : $i;
                } else {
                    $i++;
                }
            };
        });

        return ($i ? "($i)" : '');
    }
714018
public function flush()
    {
        if (null === $this->routesFactory) {
            $routes = new RouteCollection();
        } else {
            $routes = $this->routesFactory;
        }

        return $this->doFlush('', $routes);
    }
1096357
private function getMatchedVars(RouteInterface $route, array $matches)
    {
        $vars = $route->getContext()->getVars();
        $params = array_merge(
            $route->getDefaults(),
            array_filter(array_map(
                [$this, 'getValue'],
                array_intersect_key(
                    $matches,
                    $t = array_combine($vars, array_pad([], count($vars), null))
                )
            ))
        );

        return array_intersect_key($params, $t);
    }