replaceRelativePathElements() public static method

.") in a given path
public static replaceRelativePathElements ( string $path ) : string
$path string absolute node path with relative path elements ("." or "..").
return string
コード例 #1
0
 /**
  * Normalizes the given node path to a reference path and returns an absolute path.
  *
  * You should usually use \Neos\ContentRepository\Domain\Service\NodeService::normalizePath()  because functionality could be overloaded,
  * this is here only for low level operations.
  *
  *
  * @see \Neos\ContentRepository\Domain\Service\NodeService::normalizePath()
  * @param $path
  * @param string $referencePath
  * @return string
  */
 public static function normalizePath($path, $referencePath = null)
 {
     if ($path === '.') {
         return $referencePath;
     }
     if (!is_string($path)) {
         throw new \InvalidArgumentException(sprintf('An invalid node path was specified: is of type %s but a string is expected.', gettype($path)), 1357832901);
     }
     if (strpos($path, '//') !== false) {
         throw new \InvalidArgumentException('Paths must not contain two consecutive slashes.', 1291371910);
     }
     if ($path[0] === '/') {
         $absolutePath = $path;
     } else {
         $absolutePath = NodePaths::addNodePathSegment($referencePath, $path);
     }
     $normalizedPath = NodePaths::replaceRelativePathElements($absolutePath);
     return strtolower($normalizedPath);
 }