PHP Class Folder

This class has been auto-generated by the Doctrine ORM Framework
Author: Your name here
Inheritance: extends BaseFolder
ファイルを表示 Open project: getkirby/toolkit Class Usage Examples

Protected Properties

Property Type Description
$inventory a cache for the scanned inventory
$root the root for the directory

Public Methods

Method Description
__construct ( $root ) Constructor
__toString ( ) : string Makes it possible to echo the entire object
child ( $path ) : mixed Returns a subfolder object by path
children ( array $ignore = null, boolean $plain = false ) : mixed Return a collection of subfolders
clean ( ) : boolean Alternative for flush
content ( array $ignore = null ) : Collection Returns a collection with full File and Directory objects for each item in the directory
copy ( string $to ) : boolean Copies the directory to a new location
create ( boolean $recursive = true ) : boolean Alternative for make
delete ( boolean $keep = false ) : boolean Deletes the directory
exists ( ) : boolean Checks if the dir exists
files ( array $ignore = null, boolean $plain = false ) : mixed Return a collection of all files within the directory
flush ( ) : boolean Deletes all contents of the directory
hash ( ) Returns a md5 hash of the root
inventory ( ) : array Returns the entire content of the directory
isReadable ( ) : boolean Checks if the directory is readable
isWritable ( boolean $recursive = false ) : boolean Checks if the directory is writable
make ( boolean $recursive = true ) : boolean Creates the directory if it does not exist yet
modified ( $format = null, $handler = 'date' ) : integer Recursively check when the dir and all subfolders have been modified for the last time.
move ( string $to ) : boolean Moves the directory to a new location
name ( ) : string Returns the name of the directory without the full path
niceSize ( ) : string Returns the size as a human-readable string
parent ( ) : Directory Returns the parent directory object
read ( array $ignore = null ) : array Alternative for scan
remove ( boolean $keep = false ) : boolean Alternative for delete
root ( ) Returns the root of the directory
scan ( array $ignore = null ) : array Reads the directory content and returns an array with file objects
size ( ) : integer Returns the entire size of the directory and all its contents
type ( ) : string Corresponding method to File::type() which makes it possible to filter a collection of files and directories by type.
zip ( string $to ) Zip the current directory

Method Details

__construct() public method

Constructor
public __construct ( $root )

__toString() public method

Makes it possible to echo the entire object
public __toString ( ) : string
return string

child() public method

Returns a subfolder object by path
public child ( $path ) : mixed
return mixed Directory

children() public method

Return a collection of subfolders
public children ( array $ignore = null, boolean $plain = false ) : mixed
$ignore array
$plain boolean
return mixed If $plain is true an array will be returned. Otherwise a Collection

clean() public method

Alternative for flush
public clean ( ) : boolean
return boolean

content() public method

Returns a collection with full File and Directory objects for each item in the directory
public content ( array $ignore = null ) : Collection
$ignore array
return Collection

copy() public method

Copies the directory to a new location
public copy ( string $to ) : boolean
$to string
return boolean

create() public method

Alternative for make
public create ( boolean $recursive = true ) : boolean
$recursive boolean
return boolean

delete() public method

Deletes the directory
public delete ( boolean $keep = false ) : boolean
$keep boolean Set this to true to keep the directory but delete all its content
return boolean

exists() public method

Checks if the dir exists
public exists ( ) : boolean
return boolean

files() public method

Return a collection of all files within the directory
public files ( array $ignore = null, boolean $plain = false ) : mixed
$ignore array
$plain boolean
return mixed When $plain is true an array will be returned. Otherwise a Collection

flush() public method

Deletes all contents of the directory
public flush ( ) : boolean
return boolean

hash() public method

Returns a md5 hash of the root
public hash ( )

inventory() public method

Returns the entire content of the directory
public inventory ( ) : array
return array

isReadable() public method

Checks if the directory is readable
public isReadable ( ) : boolean
return boolean

isWritable() public method

Checks if the directory is writable
public isWritable ( boolean $recursive = false ) : boolean
$recursive boolean
return boolean

make() public method

Creates the directory if it does not exist yet
public make ( boolean $recursive = true ) : boolean
$recursive boolean
return boolean

modified() public method

Recursively check when the dir and all subfolders have been modified for the last time.
public modified ( $format = null, $handler = 'date' ) : integer
return integer

move() public method

Moves the directory to a new location
public move ( string $to ) : boolean
$to string
return boolean

name() public method

Returns the name of the directory without the full path
public name ( ) : string
return string

niceSize() public method

Returns the size as a human-readable string
public niceSize ( ) : string
return string

parent() public method

Returns the parent directory object
public parent ( ) : Directory
return Directory

read() public method

Alternative for scan
public read ( array $ignore = null ) : array
$ignore array
return array

remove() public method

Alternative for delete
public remove ( boolean $keep = false ) : boolean
$keep boolean Set this to true to keep the directory but delete all its content
return boolean

root() public method

Returns the root of the directory
public root ( )

scan() public method

Reads the directory content and returns an array with file objects
public scan ( array $ignore = null ) : array
$ignore array
return array

size() public method

Returns the entire size of the directory and all its contents
public size ( ) : integer
return integer

type() public method

Corresponding method to File::type() which makes it possible to filter a collection of files and directories by type.
public type ( ) : string
return string

zip() public method

Zip the current directory
public zip ( string $to )
$to string The path to the zip file

Property Details

$inventory protected_oe property

a cache for the scanned inventory
protected $inventory

$root protected_oe property

the root for the directory
protected $root