Properties

$path

$path : string

The directory path

Type

string

$files

$files : array

The files within the directory

Type

array

$tree

$tree : array

The nested tree map of the directory and its files

Type

array

$absolute

$absolute : boolean

Flag to store the absolute path.

Type

boolean

$relative

$relative : boolean

Flag to store the relative path.

Type

boolean

$recursive

$recursive : boolean

Flag to dig recursively.

Type

boolean

$filesOnly

$filesOnly : boolean

Flag to include only files and no directories

Type

boolean

Methods

__construct()

__construct(string  $dir, array  $options = array()) 

Constructor

Instantiate a directory object

Parameters

string $dir
array $options

Throws

\Pop\Dir\Exception

count()

count() : integer

Method to get the count of files in the directory

Returns

integer

getIterator()

getIterator() : \ArrayIterator

Method to iterate over the files

Returns

\ArrayIterator

setAbsolute()

setAbsolute(boolean  $absolute) : \Pop\Dir\Dir

Set absolute

Parameters

boolean $absolute

Returns

\Pop\Dir\Dir

setRelative()

setRelative(boolean  $relative) : \Pop\Dir\Dir

Set relative

Parameters

boolean $relative

Returns

\Pop\Dir\Dir

setRecursive()

setRecursive(boolean  $recursive) : \Pop\Dir\Dir

Set recursive

Parameters

boolean $recursive

Returns

\Pop\Dir\Dir

setFilesOnly()

setFilesOnly(boolean  $filesOnly) : \Pop\Dir\Dir

Set files only

Parameters

boolean $filesOnly

Returns

\Pop\Dir\Dir

isAbsolute()

isAbsolute() : boolean

Is absolute

Returns

boolean

isRelative()

isRelative() : boolean

Is relative

Returns

boolean

isRecursive()

isRecursive() : boolean

Is recursive

Returns

boolean

isFilesOnly()

isFilesOnly() : boolean

Is files only

Returns

boolean

getPath()

getPath() : string

Get the path

Returns

string

getFiles()

getFiles() : array

Get the files

Returns

array

getTree()

getTree() : array

Get the tree

Returns

array

copyTo()

copyTo(string  $destination, boolean  $full = true) : void

Copy an entire directory recursively to another destination directory

Parameters

string $destination
boolean $full

emptyDir()

emptyDir(boolean  $remove = false, string  $path = null) : void

Empty an entire directory

Parameters

boolean $remove
string $path

Throws

\Pop\Dir\Exception

offsetExists()

offsetExists(mixed  $offset) : boolean

ArrayAccess offsetExists

Parameters

mixed $offset

Returns

boolean

offsetGet()

offsetGet(mixed  $offset) : mixed

ArrayAccess offsetGet

Parameters

mixed $offset

Returns

mixed

offsetSet()

offsetSet(string  $offset, mixed  $value) : void

ArrayAccess offsetSet

Parameters

string $offset
mixed $value

Throws

\Pop\Dir\Exception

offsetUnset()

offsetUnset(string  $offset) : void

ArrayAccess offsetUnset

Parameters

string $offset

Throws

\Pop\Dir\Exception

traverse()

traverse() : void

Traverse the directory

traverseRecursively()

traverseRecursively() : void

Traverse the directory recursively

buildTree()

buildTree(\DirectoryIterator  $it) : array

Build the directory tree

Parameters

\DirectoryIterator $it

Returns

array