Replace all of the wildcard parameters for a route path.

@param  string  $path
@param  array  $parameters
@return string
17396
protected function replaceRouteParameters($path, array &$parameters)
    {
        $this->ensureTenancyInParameters($path, $parameters);

        $path = $this->replaceNamedParameters($path, $parameters);

        $path = preg_replace_callback('/\{.*?\}/', function ($match) use (&$parameters) {
            return (empty($parameters) && ! Str::endsWith($match[0], '?}'))
                ? $match[0]
                : array_shift($parameters);
        }, $path);

        return trim(preg_replace('/\{.*?\?\}/', '', $path), '/');
    }
855134
protected function splitRequestPath($path)
    {
        // Domain part extract
        $parts = explode('!', $path);
        if (count($parts) > 1) {
            $domain = $parts[0];
            $path = $parts[1];
        } else {
            $domain = null;
        }

        $parts = parse_url($path);
        $basePath = !empty($parts['path']) ? $parts['path'] : '/';

        if (empty($basePath)) {
            $extension = null;
        } else {
            $extension = pathinfo($basePath, PATHINFO_EXTENSION);
            $basePath = preg_replace('~\.' . $extension . '$~', '', $basePath);
        }

        if (!in_array($extension, $this->allowedExtensions)) {
            $extension = '';
        }

        return new Route([
            'domain' => $domain,
            'basepath' => $basePath,
            'extension' => $extension,
        ]);
    }
351329
protected function getUri($path = '', $params = array()) {
    $url = $this->getVariable('services_uri') ? $this->getVariable('services_uri') : $this->getVariable('base_uri');

    if (!empty($path))
      if (substr($path, 0, 4) == "http")
        $url = $path;
      else
        $url = rtrim($url, '/') . '/' . ltrim($path, '/');

    if (!empty($params))
      $url .= '?' . http_build_query($params, NULL, '&');

    return $url;
  }
336366
public function post($path, $parameters)
    {
        $request = $this->getRequest(static::HTTP_POST, $path, $parameters);

        return $this->sendRequest($request);
    }
321581
public static function url(string $name, ?array $parameters = [])
  {
    $url = null;

    foreach (Swish::$routes as $route) {
      if ($route['name'] == $name) {
        $url = $route['pattern'];

        if ($route['required'] > 0 && ($route['required'] == count($parameters))) {
          foreach ($parameters as $name => $parameter) {
            $url = str_replace('{' . $name . '}', $parameter, $url);
          }
        }
      }
    }

    if (str_contains($url, ['{', '}'])) $url = null;

    return $url;
  }
1323436
public static function replace($uri, $parameters = [])
    {
        $parameters = (array) $parameters;

        $uri = static::replaceRouteParameters($uri, $parameters);
        $uri = str_replace('//', '/', $uri);

        return $uri;
    }
680819
protected function url($path, array $parameters = null)
    {
    	$query = [
            'client_id' => $this->client_key,
    	    'redirect_uri' => $this->redirect_uri,
    	    'response_type' => 'code'
    	];

        if ($parameters)
            $query = array_merge($query, $parameters);

        $query = http_build_query($query);

        return sprintf('%s%s?%s', self::API_HOST, $path, $query);
    }
699206
public function replaceAll($path, array $replacements) {
        foreach ($replacements as $key => $value) {
            $path = $this->replace($path, $key, $value);
        }

        return $path;
    }
596374
protected function generatePageUrl($route, array $parameters = array())
    {
//        $parts = explode(' ', trim($page), 2);

//        $route  = implode('_', $parts);

//        $route = str_replace(' ', '_', $route);

        $path = $this->generateUrl($route, $parameters);
//        var_dump($this->getMinkParameter('base_url'));
//        var_dump($path);
//        die;
        if ('Selenium2Driver' === strstr(get_class($this->getSession()->getDriver()), 'Selenium2Driver')) {
            return sprintf('%s%s', $this->getMinkParameter('base_url'), $path);
        }
        
        return $path;
    }
1154902
protected function _relativizePath($path)
    {
        $plugins = Plugin::loaded();
        $index = array_search('AssetCompress', $plugins);
        unset($plugins[$index]);

        foreach ($plugins as $plugin) {
            $pluginPath = Plugin::path($plugin) . 'webroot';
            if (strpos($path, $pluginPath) === 0) {
                return str_replace($pluginPath, '/' . Inflector::underscore($plugin), $path);
            }
        }
        $path = str_replace(WWW_ROOT, '/', $path);

        return str_replace(DS, '/', $path);
    }
255324
protected function post(string $path, array $parameters = [])
    {
        $response = $this->connection->getHttpClient()->post(
            $path,
            ['json' => $parameters]
        );

        return json_decode($response->getBody()->getContents(), true);
    }
542923
protected function generateQuery($path, TreeNodeInterface $node, $parameters)
    {
        unset($parameters['_locale']);
        unset($parameters['_preview']);

        if (count($parameters)) {
            $path .= '?'.http_build_query($parameters, '', '&');
        }

        return $path;
    }
955
protected function get($path, array $parameters = array())
    {
        if (count($parameters) > 0) {
            $path .= '?' . http_build_query($parameters);
        }

        $response = $this->client->getHttpClient()->get($path);

        return $this->parseResponse($response);
    }
193854
protected function build(array $parameters)
    {
        $route    = preg_split('`([/.-])`', $this->route, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $regex    = array();
        $position = 0;

        foreach ($route as $index => $element) {
            switch ($element) {
                case '.':
                    $regex[$element . '-' . $index] = '\\' . $element;
                    break;
                case '/':
                case '-':
                    $regex[$element . '-' . $index] = $element;
                    break;

                default:

                    if (':' === substr($element, 0, 1)) {
                        $elementName = substr($element, 1);
                        $position++;

                        if (!isset($parameters[$elementName])) {
                            $parameters[$elementName] = new Parameter($elementName);
                        }

                        $regex[$elementName] = '(' . $parameters[$elementName]->getType() . ')';

                        $this->parameterCollection->add($parameters[$elementName]);
                    } else {
                        $regex[$element] = $element;
                    }
            }
        }

        $this->pattern = '`^' . implode('', $regex) . '$`i';
    }
50003
protected function filterPath($path) : string
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Path must be a string');
        }

        $unreservedCharacter = preg_quote($this->unReservedCharacter, '/');
        $characterSubDelimiter = preg_quote($this->characterSubDelimiter, '/');
        return preg_replace_callback(
            '/(?:[^' . $unreservedCharacter . $characterSubDelimiter . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
            [$this, 'rawURLEncodeMatchZero'],
            $path
        );
    }
609594
public function getUrl($path, array $params = [])
    {
        $parts = parse_url($this->baseUrl.'/'.trim($path, '/'));

        if ($parts === false) {
            throw new InvalidArgumentException('Not a valid path.');
        }

        $parts['path'] = '/'.trim($parts['path'], '/');

        if ($this->signature) {
            $params = $this->signature->addSignature($parts['path'], $params);
        }

        return $this->buildUrl($parts, $params);
    }
69237
protected function buildApiUrl(string $path, array $parameters): string
    {
        $parameters = array_merge([
            'access_token' => $this->accessToken,
        ], $parameters);

        $query = http_build_query($parameters, '', '&');

        return 'https://api.instagram.com/v1/'.$path.'?'.$query;
    }