function Utils::uriFor
Returns a UriInterface for the given value.
This function accepts a string or UriInterface and returns a UriInterface for the given value. If the value is already a UriInterface, it is returned as-is.
Parameters
string|UriInterface $uri:
Throws
\InvalidArgumentException
File
-
vendor/
guzzlehttp/ psr7/ src/ Utils.php, line 465
Class
Namespace
GuzzleHttp\Psr7Code
public static function uriFor($uri) : UriInterface {
if ($uri instanceof UriInterface) {
return $uri;
}
if (is_string($uri)) {
return new Uri($uri);
}
throw new \InvalidArgumentException('URI must be a string or UriInterface');
}