You are here

public function UriTemplate::expand in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/guzzle/src/UriTemplate.php \GuzzleHttp\UriTemplate::expand()

File

vendor/guzzlehttp/guzzle/src/UriTemplate.php, line 38

Class

UriTemplate
Expands URI templates. Userland implementation of PECL uri_template.

Namespace

GuzzleHttp

Code

public function expand($template, array $variables) {
  if (false === strpos($template, '{')) {
    return $template;
  }
  $this->template = $template;
  $this->variables = $variables;
  return preg_replace_callback('/\\{([^\\}]+)\\}/', [
    $this,
    'expandMatch',
  ], $this->template);
}