/** * @return bool|string * @throws Exception */ function get_url() { $service_url = $this->client->get_service_url($this->service); if (count($this->vars)) { $query_vars = $this->vars; foreach ($query_vars as $name => $value) { /** * @var array $matches Get all URL path var matches into an array */ preg_match_all('#([^{]+)\\{([^}]+)\\}#', $this->service->path, $matches); $path_vars = array_flip($matches[2]); if (isset($path_vars[$name])) { $var = $this->client->get_var($name); $value = $var->apply_transforms($value); $service_url = str_replace("{{$name}}", $value, $service_url); unset($query_vars[$name]); } } $service_url .= '?' . http_build_query($query_vars); } return $service_url; }