code: private function fillPathParams($uri, array &$paramValues)
      {
          return preg_replace_callback('/{(\S+)}/U', function ($matches) use (&$paramValues) {
              $path = $matches[1];
              if (array_key_exists($path, $paramValues)) {
                  $value = $paramValues[$path];
                  unset($paramValues[$path]);
              } else {
                  $value = $path;
              }
              return $value;
          }, $uri);
      }
docs: Replaces path parameters placeholders in the uri with the correct values.
  
  @param string $uri A uri with path parameters.
  @param array $paramValues Associative array of path parameter names and their values.
  
  @return string The path.