directory = $directory; $this->path = $path; } /** * @return boolean Whether this file exists. */ public function exists() { return $this->directory->isFile($this->path); } /** * @return string The file's basename. */ public function getBasename() { return pathinfo($this->path, PATHINFO_BASENAME); } /** * Get the text content of this file. Empty string if it doesn't exist. * * @return string */ public function getContents() { return $this->directory->getContents($this->path); } /** * @return string The file's extension. */ public function getExtension() { return pathinfo($this->path, PATHINFO_EXTENSION); } /** * Do a PHP include of the file and return the result. * * TODO(ewinslow): This may only work for local filesystems? * * @return mixed */ public function includeFile() { return $this->directory->includeFile($this->path); } /** @inheritDoc */ public function __toString() { return $this->path; } }