You are here

public function Uri::withFragment in Lockr 7.3

Return an instance with the specified URI fragment.

This method MUST retain the state of the current instance, and return an instance that contains the specified URI fragment.

Users can provide both encoded and decoded fragment characters. Implementations ensure the correct encoding as outlined in getFragment().

An empty fragment value is equivalent to removing the fragment.

Parameters

string $fragment The fragment to use with the new instance.:

Return value

static A new instance with the specified fragment.

Overrides UriInterface::withFragment

File

vendor/guzzlehttp/psr7/src/Uri.php, line 516

Class

Uri
PSR-7 URI implementation.

Namespace

GuzzleHttp\Psr7

Code

public function withFragment($fragment) {
  $fragment = $this
    ->filterQueryAndFragment($fragment);
  if ($this->fragment === $fragment) {
    return $this;
  }
  $new = clone $this;
  $new->fragment = $fragment;
  return $new;
}