WordPress\AiClientDependencies\Nyholm\Psr7

Uri::__constructpublicWP 1.0

Method of the class: Uri{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Uri = new Uri();
$Uri->__construct( $uri );
$uri(string)
.
Default: ''

Uri::__construct() code WP 7.0

public function __construct(string $uri = '')
{
    if ('' !== $uri) {
        if (\false === $parts = \parse_url($uri)) {
            throw new \InvalidArgumentException(\sprintf('Unable to parse URI: "%s"', $uri));
        }
        // Apply parse_url parts to a URI.
        $this->scheme = isset($parts['scheme']) ? \strtr($parts['scheme'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
        $this->userInfo = $parts['user'] ?? '';
        $this->host = isset($parts['host']) ? \strtr($parts['host'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
        $this->port = isset($parts['port']) ? $this->filterPort($parts['port']) : null;
        $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : '';
        $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : '';
        $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : '';
        if (isset($parts['pass'])) {
            $this->userInfo .= ':' . $parts['pass'];
        }
    }
}