getRouteVars

@param RouteContextInterface $context
@param array $parameters

@return array
509019
private function getRouteVars(RouteContextInterface $context, array $parameters)
    {
        return array_merge(
            array_combine(array_values($v = $context->getVars()), array_fill(1, count($v), null)),
            $parameters
        );
    }
1087665
public function getProvidersByContext($context)
    {
        $providers = array();
        
        foreach($this->providers[$context] as $providerId) {
            $providers[] = $this->container->get($providerId);
        }
        
        return $providers;
    }
1207347
private function createMap(RouteCollectionInterface $routes)
    {
        $i    = 0;
        $m    = [];
        $rpl  = sprintf(self::NGRP_RPLC, Ps::EXP_DELIM);
        $expr = [];
        $pfx  = 'r'.time();
        $expr['prefix'] = $pfx;

        foreach ($routes->all() as $name => $route) {
            foreach ($route->getMethods() as $method) {
                $m[$method][$name] = $route;
            }
        }

        foreach ($m as $mn => $rts) {
            $mn = strtolower($mn);
            $expr[$mn]['map'] = [];
            $regex = [];

            foreach ($rts as $rn => $rt) {
                $ctx      = $rt->getContext();
                $index    = $pfx.'_'.$this->replaceRouteName($rn, $i);
                $ctxRegex = preg_replace($rpl, '$1r'.(string)$i.'_$2>', $ctx->getRegex(true));
                $regex[]  = sprintf('(?P<%s>%s)', $index, $ctxRegex);
                $expr[$mn]['map'][$index] = [$i, $rn, 'r'.$i.'_'];
                $i++;
            }

            $i = 0;
            $expr[$mn]['regex'] = sprintf('%1$s(?:^'.join('|', $regex).')$%1$sx', Ps::EXP_DELIM);
        }

        return $expr;
    }
475209
public function loadModuleByParameters(array $parameters)
    {
        if (!isset($parameters['module'])) {
            throw new \InvalidArgumentException('The routing provider expected parameter "module" but could not find it.');
        }

        if ($parameters['module'] instanceof ModuleInterface) {
            return $parameters['module'];
        }

        $identity = $parameters['module'];

        // Get the related module
        $module = $this->manager->findModuleByIdentity($identity);

        if (!$module instanceof ModuleInterface) {
            throw new ResourceNotFoundException(sprintf('Module with identity "%s" does not exist.', $identity));
        }

        return $module;
    }
689748
public function generate($routeName, array $parameters = [])
    {
        $route = $this->router->getRoute($routeName);

        $required = $route->getParameterPatterns();
        $missing  = array_diff_key($required, $parameters);

        if (!empty($missing)) {
            $parameters = $this->insertDefaultParameterValues($route, $missing, $parameters);
        }

        return $this->buildPath($route->getPath(), $parameters, array_keys($required));
    }
307428
public static function listAllGatewaysAsync(array $parameters = [])
    {
        return self::listAllGatewaysAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
1192033
public function getPath($parameters = null)
    {
        if (empty($parameters) || !is_array($parameters) || empty($this->patternString)) {
            return $this->path;
        }

        //If an array of parameters is specified and a pattern string exists, we can build a path for the route
        $pattern = $this->patternString;
        foreach ($parameters as $parameterName => $parameterValue) {
            $pattern = preg_replace('#\[?\{[^:]+:' . preg_quote($parameterName, '#') . '\}\]?#', $parameterValue, $pattern);
        }

        //Delete remaining unmatched parameters
        $pattern = preg_replace('#\/\[?\{[^}]+\}\]?#', '', $pattern);

        return $this->path . $pattern;
    }
264
public function dispatch(Route $route, Request $request = null)
    {
        $context = $this->context;

        if (empty($this->context) && !empty($request)) {
            // If we have no context, but do have a request, prepare a context to store path variables in.
            // Otherwise routing path variables would be lost for no good reason.
            $context = new Context();
            $context->registerInstance($request);
        }

        if (!empty($context)) {
            // If we have a context, ensure that the route is made available in it.
            $context->registerInstance($route);

            if (!empty($request)) {
                // If we have a request, map the path variables and pass them to the context as primitive types by name.
                // This will allow us to inject info from a route e.g. "/view/$userId" to a $userId variable.
                $pathVariables = VariableUrl::extractUrlVariables($request->getRequestUri(), $route->getPattern());

                foreach ($pathVariables as $name => $value) {
                    $context->registerVariable($name, $value);
                }
            }
        }

        return $route->action($context);
    }
796617
private function getParameterNamesForParentCall(array $parameters)
    {
        return array_map(
            function (\ReflectionParameter $parameter) {
                $name = '';

                if ($parameter->isVariadic()) {
                    $name .= '...';
                }

                $name .= '$' . $parameter->getName();

                return $name;
            },
            $parameters
        );
    }
337068
public function route($name, $parameters = [])
    {
        $route = router()->route($name);
        if (is_null($route)) {
            throw new \Exception("Route name [$name] not found");
        }

        $route_url = $route->url($parameters);

        return $this->to($route_url);
    }
444271
public function getPath($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, false);
    }
709349
protected function replaceRouteParameters($route, &$parameters = [])
    {
        return \preg_replace_callback('/\{(.*?)(:.*?)?(\{[0-9,]+\})?\}/', function ($m) use (&$parameters) {
            return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0];
        }, $route);
    }
285786
private function getRoutesFromIndex (&$routes, &$routesIndex, &$requestMethod, &$requestPathParts, $requestPathIndex = 0) {
        if (!empty($requestPathParts[$requestPathIndex])) {
            $requestPathPart = $requestPathParts[$requestPathIndex];
            if (array_key_exists($requestPathPart, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[$requestPathPart], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
            if (array_key_exists(self::ROUTE_PARAMETER_WILDCARD, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[self::ROUTE_PARAMETER_WILDCARD], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
        }
        else if (array_key_exists(self::ROUTE_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod,$requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }

        if (array_key_exists(self::ROUTE_GENERIC_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_GENERIC_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod, $requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }
    }
1158320
private function getParameterFromContext(array $context, string $parameterName, $default = null)
    {
        $filters = $context['filters'] ?? [];

        return \array_key_exists($parameterName, $filters) ? $filters[$parameterName] : $default;
    }
557481
public function currentPageUrl($parameters = [], $routePersistence = true)
    {
        if (!$currentFile = $this->page->getFileName()) {
            return null;
        }

        return $this->pageUrl($currentFile, $parameters, $routePersistence);
    }
790651
public function route($name, $parameters = [])
    {
        $path = $this->routes->getPath($name, $parameters);
        $path = ltrim($path, '/');

        return $this->baseUrl.'/'.$path;
    }
1044257
protected function replaceRoutableParameters($parameters = array())
	{
		$parameters = is_array($parameters) ? $parameters : array($parameters);

		foreach ($parameters as $key => $parameter)
		{
			if ($parameter instanceof UrlRoutable)
			{
				$parameters[$key] = $parameter->getRouteKey();
			}
		}

		return $parameters;
	}