You are here

protected function FeedSet::canonicalizePath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/FeedSet.php \Zend\Feed\Reader\FeedSet::canonicalizePath()

Canonicalize relative path

1 call to FeedSet::canonicalizePath()
FeedSet::absolutiseUri in vendor/zendframework/zend-feed/src/Reader/FeedSet.php
Attempt to turn a relative URI into an absolute URI

File

vendor/zendframework/zend-feed/src/Reader/FeedSet.php, line 94

Class

FeedSet

Namespace

Zend\Feed\Reader

Code

protected function canonicalizePath($path) {
  $parts = array_filter(explode('/', $path));
  $absolutes = [];
  foreach ($parts as $part) {
    if ('.' == $part) {
      continue;
    }
    if ('..' == $part) {
      array_pop($absolutes);
    }
    else {
      $absolutes[] = $part;
    }
  }
  return implode('/', $absolutes);
}