PHP Class Jarves\Filesystem\Filesystem

Inheritance: implements Jarves\Filesystem\FilesystemInterface
Show file Open project: jarves/jarves Class Usage Examples

Protected Properties

Property Type Description
$adapter Jarves\Filesystem\Adapter\AdapterInterface

Public Methods

Method Description
checkFileValues ( FileInfo $file, File $databaseFile )
copy ( $source, $target )
createFromPathInfo ( Jarves\File\FileInfoInterface $fileInfo )
delete ( string $path ) : boolean
filemtime ( $path )
getAdapter ( string | null $path = null ) : Jarves\Filesystem\Adapter\AdapterInterface
getCount ( string $folderPath ) : mixed Returns the file count inside $folderPath
getFile ( string $path ) : Jarves\File\FileInfoInterface Return information for a file/folder.
getFiles ( string $path ) : File[] List directory contents.
getResizeMax ( string $path, integer $width, integer $height ) : PHPImageWorkshop\Core\ImageWorkshopLayer Resize a image and returns it's object.
getThumbnail ( string $path, string $resolution, boolean $resize = false ) : resource
handle ( string $path ) : resource
has ( string $path ) : boolean
hash ( $path )
mkdir ( $path )
move ( $source, $target )
normalizePath ( string | array $path ) : string Removes the name of the mount point from the proper layer.
read ( string $path ) : string
remove ( string $path ) : boolean
rename ( $source, $target )
search ( $path, $q, $depth ) : array
setAdapter ( Jarves\Filesystem\Adapter\AdapterInterface $adapter )
write ( string $path, string $content = '' ) : boolean
writeImage ( resource $image, string $path, integer $quality = 8 ) : boolean

Method Details

checkFileValues() public method

public checkFileValues ( FileInfo $file, File $databaseFile )
$file Jarves\File\FileInfo
$databaseFile Jarves\Model\File

copy() public method

public copy ( $source, $target )

createFromPathInfo() public method

public createFromPathInfo ( Jarves\File\FileInfoInterface $fileInfo )
$fileInfo Jarves\File\FileInfoInterface

delete() public method

public delete ( string $path ) : boolean
$path string
return boolean

filemtime() public method

public filemtime ( $path )

getAdapter() public method

public getAdapter ( string | null $path = null ) : Jarves\Filesystem\Adapter\AdapterInterface
$path string | null
return Jarves\Filesystem\Adapter\AdapterInterface

getCount() public method

Returns the file count inside $folderPath
public getCount ( string $folderPath ) : mixed
$folderPath string
return mixed

getFile() public method

The result contains following information: [path(relative), name, type(dir|file), ctime(unixtimestamp), mtime(unixtimestamp), size(bytes)] array( path => path to this file/folder for usage in the administration and modules. Not the full http path. No trailing slash! name => basename(path) ctime => as unix timestamps mtime => as unix timestamps size => filesize in bytes (not for folders) type => 'dir' or 'file' )
public getFile ( string $path ) : Jarves\File\FileInfoInterface
$path string
return Jarves\File\FileInfoInterface

getFiles() public method

Same as in getFile() but in a list. array( array( path => path to the file/folder for usage in the administration and modules. Not the full http path. No trailing slash! name => basename(path) ctime => as unix timestamps mtime => as unix timestamps size => filesize in bytes (not for folders) type => 'file' | 'dir' mount => boolean (if the folder is a mount point) ) )
public getFiles ( string $path ) : File[]
$path string
return Jarves\Model\File[]

getResizeMax() public method

Resize a image and returns it's object.
public getResizeMax ( string $path, integer $width, integer $height ) : PHPImageWorkshop\Core\ImageWorkshopLayer
$path string
$width integer
$height integer
return PHPImageWorkshop\Core\ImageWorkshopLayer

getThumbnail() public method

public getThumbnail ( string $path, string $resolution, boolean $resize = false ) : resource
$path string
$resolution string x
$resize boolean
return resource

handle() public method

public handle ( string $path ) : resource
$path string
return resource

has() public method

public has ( string $path ) : boolean
$path string
return boolean

hash() public method

public hash ( $path )

mkdir() public method

public mkdir ( $path )

move() public method

public move ( $source, $target )

normalizePath() public method

Also removes '..' and replaces '//' => '/' This is needed because the file layer gets the relative path under his own root. Forces a / at the beginning, removes the trailing / if exists.
public normalizePath ( string | array $path ) : string
$path string | array
return string

read() public method

public read ( string $path ) : string
$path string
return string

remove() public method

public remove ( string $path ) : boolean
$path string
return boolean

rename() public method

public rename ( $source, $target )

setAdapter() public method

public setAdapter ( Jarves\Filesystem\Adapter\AdapterInterface $adapter )
$adapter Jarves\Filesystem\Adapter\AdapterInterface

write() public method

public write ( string $path, string $content = '' ) : boolean
$path string
$content string
return boolean

writeImage() public method

public writeImage ( resource $image, string $path, integer $quality = 8 ) : boolean
$image resource
$path string
$quality integer between 0 and 10
return boolean

Property Details

$adapter protected property

protected AdapterInterface,Jarves\Filesystem\Adapter $adapter
return Jarves\Filesystem\Adapter\AdapterInterface