protected function Link::canonicalizePath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Link.php \Symfony\Component\DomCrawler\Link::canonicalizePath()
Returns the canonicalized URI path (see RFC 3986, section 5.2.4).
Parameters
string $path URI path:
Return value
string
1 call to Link::canonicalizePath()
- Link::getUri in vendor/
symfony/ dom-crawler/ Link.php - Gets the URI associated with this link.
File
- vendor/
symfony/ dom-crawler/ Link.php, line 142
Class
- Link
- Link represents an HTML link (an HTML a, area or link tag).
Namespace
Symfony\Component\DomCrawlerCode
protected function canonicalizePath($path) {
if ('' === $path || '/' === $path) {
return $path;
}
if ('.' === substr($path, -1)) {
$path .= '/';
}
$output = array();
foreach (explode('/', $path) as $segment) {
if ('..' === $segment) {
array_pop($output);
}
elseif ('.' !== $segment) {
$output[] = $segment;
}
}
return implode('/', $output);
}