Phly\Http\Uri::withFragment PHP Method

withFragment() public method

public withFragment ( $fragment )
    public function withFragment($fragment)
    {
        $fragment = $this->filterFragment($fragment);
        if ($fragment === $this->fragment) {
            // Do nothing if no change was made.
            return clone $this;
        }
        $new = clone $this;
        $new->fragment = $fragment;
        return $new;
    }

Usage Example

Beispiel #1
0
 public function testStripsFragmentPrefixIfPresent()
 {
     $uri = new Uri('http://example.com');
     $new = $uri->withFragment('#/foo/bar');
     $this->assertEquals('/foo/bar', $new->getFragment());
 }
All Usage Examples Of Phly\Http\Uri::withFragment