Exemplo n.º 1
0
 /**
  * Get full file path or its directory (with trailing slash)
  * @param File $file
  * @param boolean $includeFilename
  * @param integer $forcePath Forces external or internal path. Use FILE_INFO_EXTERNAL and FILE_INFO_INTERNAL constants
  * @return string
  */
 public function getFilesystemPath(FileAbstraction $file, $includeFilename = true, $forcePath = null)
 {
     if (!$file instanceof FileAbstraction) {
         throw new Exception\RuntimeException('File or folder entity expected');
     }
     $path = $this->getInternalPath();
     if ($forcePath != self::FILE_INFO_INTERNAL) {
         if ($file->isPublic() || $forcePath == self::FILE_INFO_EXTERNAL) {
             $path = $this->getExternalPath();
         }
     }
     $path .= $file->getPath(DIRECTORY_SEPARATOR, $includeFilename);
     if (!$includeFilename) {
         $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     }
     return $path;
 }