Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Utils.php

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

Utils

Namespace

GuzzleHttp\Psr7

Code

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');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal