/** * {@inheritdoc} */ public function getRelativeUrl(UrlInterface $ref_url = null) { if (is_null($ref_url)) { return $this->path->getUriComponent() . $this->query->getUriComponent() . $this->fragment->getUriComponent(); } elseif ($this->getBaseUrl() != $ref_url->getBaseUrl()) { return $this->__toString(); } return $this->path->getRelativePath($ref_url->getPath()) . $this->query->getUriComponent() . $this->fragment->getUriComponent(); }
public function testGetRelativePathDiff() { $path = new Path('/toto/'); $other = new Path('/toto/le/heros/masson'); $this->assertSame('../../../', $path->getRelativePath($other)); }