Jarves\File\FileInfo::setPath PHP Method

setPath() public method

public setPath ( string $path )
$path string
    public function setPath($path)
    {
        $this->path = $path;
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 public function getFile($path)
 {
     $file = new \Jarves\File\FileInfo();
     $file->setPath($path ?: '/');
     $path = $this->getFullPath($path ?: '/');
     if (!file_exists($path)) {
         throw new FileNotFoundException(sprintf('File `%s` does not exists.', $path));
     }
     if (!is_readable($path)) {
         throw new FileNotFoundException(sprintf('File `%s` is not readable.', $path));
     }
     $file->setType(is_dir($path) ? 'dir' : 'file');
     $file->setCreatedTime(filectime($path));
     $file->setModifiedTime(filectime($path));
     $file->setSize(filesize($path));
     return $file;
 }
All Usage Examples Of Jarves\File\FileInfo::setPath