@param string $name
@param Route  $route

@return array
@throws \InvalidArgumentException
334949
public function getOptions($name, Route $route)
    {
        $option = $route->getOption('sitemap');

        if ($option === null) {
            return null;
        }

        if (is_string($option)) {
            $decoded = json_decode($option, true);
            if (!json_last_error() && is_array($decoded)) {
                $option = $decoded;
            }
        }

        if (!is_array($option) && !is_bool($option)) {
            $bool = filter_var($option, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

            if (null === $bool) {
                throw new \InvalidArgumentException(
                    sprintf(
                        'The sitemap option must be of type "boolean" or "array", got "%s"',
                        $option
                    )
                );
            }

            $option = $bool;
        }

        if (!$option) {
            return null;
        }

        $options = [
            'lastmod' => null,
            'changefreq' => null,
            'priority' => null,
        ];
        if (is_array($option)) {
            $options = array_merge($options, $option);
        }

        if (is_string($options['lastmod'])) {
            try {
                $options['lastmod'] = new \DateTime($options['lastmod']);
            } catch (\Exception $e) {
                throw new \InvalidArgumentException(
                    sprintf(
                        'The route %s has an invalid value "%s" specified for the "lastmod" option',
                        $name,
                        $options['lastmod']
                    ),
                    0,
                    $e
                );
            }
        }

        return $options;
    }
635793
public function addNamedRoute($name, \Yee\Route $route)
    {
        if ($this->hasNamedRoute($name)) {
            throw new \RuntimeException('Named route already exists with name: ' . $name);
        }
        $this->namedRoutes[(string) $name] = $route;
    }
480107
public function getParameter(string $name): string
    {
        if (!isset($this->values[$name])) {
            throw new \InvalidArgumentException("Invalid route parameter '$name'");
        }

        return $this->values[$name];
    }
195287
public function add($name, Route $route)
    {
        unset($this->routes[$name]);

        $this->routes[$name] = $route;
    }
63094
public function get(string $route, $action, ?string $name = null): Route
	{
		return $this->registerRoute(['GET', 'HEAD', 'OPTIONS'], $route, $action, $name);
	}
1296415
public static function route($route, $name = null)
    {
        // 404 Route
        if ($route == '404') {
            return static::$routes['404'] = new Route('404', '404');
        }

        if ($name) {
            return static::$routes[$name] = new Route($route, $name);
        } else {
            return static::$routes[] = new Route($route);
        }
    }
1347982
public function add($name, RouteInterface $route)
    {
        $this->routes[(string) $name] = $route;

        return $this;
    }
665921
public function attach($name, RouteInterface $route)
    {
        if ($this->groupAttributes !== null) {
            // This route is part of a group of routes that share common attributes.
            // Merge those attributes with the existing options.
            $route->setOptions($this->groupAttributes);
        }

        $options = $route->getOptions();
        $method  = isset($options['method']) ? strtoupper($options['method']) : '*';
        $scheme  = isset($options['scheme']) ? $options['scheme'] : $this->defaultScheme;
        $this->routes[$scheme][$method][$name] = $route;

        return $this;
    }
976233
public function getRouteAttributes($name = null, $default = null)
    {
        /** @var Route $route */
        $route = $this->request->getAttribute('route', false);
        $attributes = $route
            ? $route->attributes
            : [];
        
        if (null == $name) {
            return $attributes;
        }
        
        return array_key_exists($name, $attributes)
            ? $attributes[$name]
            : $default;
    }
1240697
private function getParameters(Contracts\Request $request, $route)
    {
        $path    = $request->path();
        $pattern = $this->pattern($route);
        if (preg_match_all($pattern, $path, $matches, PREG_SET_ORDER) === false) {
            return []; // @codeCoverageIgnore
        }

        unset($matches[0][0]);
        $matches = array_values($matches[0]);

        return $matches;
    }
1051300
public function route($name, $parameters = array(), $absolute = true, $route = null)
    {
        return $this->forwarder()->route($name, $parameters, $absolute, $route);
    }
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
960303
protected function getRouteUri($name, $params = array())
    {
        // If the route needs additional parameters, we can't add it
        try {
            return $this->router->generate($name, $params, UrlGeneratorInterface::ABSOLUTE_URL);
        } catch (MissingMandatoryParametersException $e) {
            throw new \InvalidArgumentException(
                sprintf(
                    'The route "%s" cannot have the sitemap option because it requires parameters other than "%s"',
                    $name,
                    implode('", "', array_keys($params))
                ),
                0,
                $e
            );
        }
    }
1203830
protected function renderWithParameters(Route $route, $name = null, array $parameter = array())
    {
        $request = $this->buildRequest($route, $name, $parameter);

        $response = $this->kernel->handle($request);
        $content = $response->getContent();
        $this->kernel->terminate($request, $response);
        $this->kernel->shutdown();

        if (null !== $name) {
            $filename = $this->router->generate($name, $parameter);
        } else {
            $filename = $route->getPath();
        }

        $this->writer->write($filename, $content);
    }
1077128
public function getRouteProperties($route, Request $request)
    {
        return [$route->uri(), $route->methods(), $route->getAction()];
    }
1229428
public function addRouteMiddleware(string $name): void
    {
        if (!array_key_exists($name, $this->getConfigRouteMiddlewares())) {
            throw new InvalidArgumentException('The middleware [' . $name . '] does not exists.');
        }

        $this->routeMiddlewares[] = $this->getConfigRouteMiddlewares()[$name];
    }
1144388
protected function buildListRoute(Route $route, $name)
    {
        $contentType = $route->getContent();
        $contents    = $this->app['content_repository']->listContents($contentType);

        $this->logger->log(sprintf(
            'Building route <comment>%s</comment> with <info>%s</info> <comment>%s(s)</comment>',
            $name,
            count($contents),
            $contentType
        ));
        $this->builder->build($route, $name);
    }