baseDir = $baseDir; $this->path = $path; } /** * Create a copy of this path with a different path name * * @param string $path * @return \mdref\Path */ function __invoke($path) { $that = clone $this; $that->path = $path; return $that; } /** * Retrurns the full path as string * @return string */ function __toString() { return $this->getFullPath(); } /** * The base directory * @return string */ function getBaseDir() { return $this->baseDir; } /** * The path name relative to the base dir * @return string */ function getPathName() { return $this->path; } /** * The full path * @param string $ext extension * @return string */ function getFullPath($ext = "") { $path = ""; if (strlen($this->baseDir)) { $path .= $this->baseDir . DIRECTORY_SEPARATOR; } if (strlen($this->path)) { $path .= $this->path; } $path .= $ext; return $path; } /** * Retrieve a another subpath within the base dir * @param type $path * @return string */ function getSubPath($path) { return trim(substr($path, strlen($this->baseDir)), DIRECTORY_SEPARATOR); } function isFile($ext = ".md") { return is_file($this->getFullPath($ext)); } function toHtml() { $head = sprintf("
" . $html .""; } }