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
コード例 #1
0
ファイル: UriTest.php プロジェクト: phly/http
 public function testStripsFragmentPrefixIfPresent()
 {
     $uri = new Uri('http://example.com');
     $new = $uri->withFragment('#/foo/bar');
     $this->assertEquals('/foo/bar', $new->getFragment());
 }
コード例 #2
0
ファイル: UriTest.php プロジェクト: easySuite/ding2
 /**
  * @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);
 }