Ergo\Http\Url::getUrlForRelativePath PHP Method

getUrlForRelativePath() public method

Builds a URL with a path component that is relative to the current one
public getUrlForRelativePath ( $path ) : Url
return Url
    public function getUrlForRelativePath($path)
    {
        return $this->getUrlForPath($this->_joinPathComponents($this->getPath(), ltrim($path, '/')));
    }

Usage Example

Example #1
0
 public function testGetForRelativePathWithOnlySlash()
 {
     $url = new Http\Url('http://example.org/test');
     $relative = $url->getUrlForRelativePath('/');
     $this->assertEquals($relative->__toString(), 'http://example.org/test');
 }