Provides a value object representing a URI for HTTP requests. Instances of this class are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current instance and return a new instance that contains the changed state.
Inheritance: implements Psr\Http\Message\UriInterface
Exemplo n.º 1
0
 public function testStripsFragmentPrefixIfPresent()
 {
     $uri = new Uri('http://example.com');
     $new = $uri->withFragment('#/foo/bar');
     $this->assertEquals('/foo/bar', $new->getFragment());
 }
Exemplo n.º 2
0
 /**
  * @group 48
  */
 public function testWithFragmentReturnsSameInstanceWhenFragmentDoesNotChange()
 {
     $uri = new Uri('http://example.com/test/path?foo=bar#/baz/bat');
     $test = $uri->withFragment('/baz/bat');
     $this->assertSame($uri, $test);
 }