WordPress\AiClientDependencies\Nyholm\Psr7

Uri::withSchemepublicWP 1.0

Method of the class: Uri{}

No Hooks.

Returns

static.

Usage

$Uri = new Uri();
$Uri->withScheme( $scheme ): UriInterface;
$scheme(required)
.

Uri::withScheme() code WP 7.0

public function withScheme($scheme): UriInterface
{
    if (!\is_string($scheme)) {
        throw new \InvalidArgumentException('Scheme must be a string');
    }
    if ($this->scheme === $scheme = \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
        return $this;
    }
    $new = clone $this;
    $new->scheme = $scheme;
    $new->port = $new->filterPort($new->port);
    return $new;
}