/** * Returns this node's path. * * @return string */ public function getPath() { if (!isset($this->cache['path'])) { if ($this->parent === NULL) { $this->cache['path'] = $this->getName(FALSE, TRUE); } else { if (substr($this->parent->getPath(), -1) == DIRECTORY_SEPARATOR) { $this->cache['path'] = $this->parent->getPath() . $this->getName(FALSE, TRUE); } else { $this->cache['path'] = $this->parent->getPath() . DIRECTORY_SEPARATOR . $this->getName(FALSE, TRUE); if ($this->parent->getPath() === '' && realpath($this->cache['path']) === FALSE && realpath($this->getName(FALSE, TRUE)) !== FALSE) { $this->cache['path'] = $this->getName(FALSE, TRUE); } } } } return $this->cache['path']; }