PHP Class Kahlan\Dir\Dir

Inheritance: extends FilterIterator
Datei anzeigen Open project: crysalead/kahlan Class Usage Examples

Protected Properties

Property Type Description
$_exclude array List of exclude patterns
$_include array List of include patterns
$_types array List of allowed types

Public Methods

Method Description
_dirFlags ( array $options ) : integer Returns FilesystemIterator flags from Dir options.
_iteratorFlags ( array $options ) : integer Returns RecursiveIteratorIterator flags from Dir options.
accept ( ) : boolean Checks if a file passes the setted filters.
copy ( array | string $path, string $dest, array $options = [] ) : array Copies a directory.
filter ( array $options = [] ) Applies some filters to a FilterIterator instance.
make ( array | string $path, array $options = [] ) : boolean Creates a directory.
remove ( array | string $path, array $options = [] ) Removes one or many directories.
scan ( array | string $path, array $options = [] ) : array Scans one or many directories for files.
tempnam ( string $path = null, string $prefix = '' ) : string Creates a directory with unique file name.

Protected Methods

Method Description
_copy ( string $path, string $dest, array $options ) : array Copies a directory.
_excluded ( $path ) : boolean Checks if a file passes match an excluded path.
_included ( $path ) : boolean Checks if a file passes match an included path.
_matchType ( ) : boolean Checks if a file passes match the allowed type.
_scan ( string $path, array $options, $dirFlags, $iteratorFlags ) : array Scans a given directory for files.

Method Details

_copy() protected static method

Copies a directory.
protected static _copy ( string $path, string $dest, array $options ) : array
$path string Source directory.
$dest string Destination directory.
$options array Scanning options. Possible values are: -`'mode'` _integer_ : Mode used for directory creation. -`'childrenOnly'` _boolean_ : Excludes parent directory if `true`. -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`. -`'recursive'` _boolean_ : Scans recursively if `true`. -`'include'` _string|array_: An array of includes. -`'exclude'` _string|array_: An array of excludes.
return array

_dirFlags() public static method

Returns FilesystemIterator flags from Dir options.
public static _dirFlags ( array $options ) : integer
$options array Scanning options. Possible values are: -`'skipDots'` _boolean_ : Keeps '.' and '..' if `true`. -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`.
return integer Some `FilesystemIterator` flags

_excluded() protected method

Checks if a file passes match an excluded path.
protected _excluded ( $path ) : boolean
return boolean Returns `true` if match an excluded path, `false` otherwise.

_included() protected method

Checks if a file passes match an included path.
protected _included ( $path ) : boolean
return boolean Returns `true` if match an included path, `false` otherwise.

_iteratorFlags() public static method

Returns RecursiveIteratorIterator flags from Dir options.
public static _iteratorFlags ( array $options ) : integer
$options array Scanning options. Possible values are: -`'iterator'` _integer_ : The iterator mode. -`'leavesOnly'` _boolean_ : Keeps only leaves if `true`.
return integer Some `RecursiveIteratorIterator` flags

_matchType() protected method

Checks if a file passes match the allowed type.
protected _matchType ( ) : boolean
return boolean Returns `true` if match the allowed type, `false` otherwise.

_scan() protected static method

Scans a given directory for files.
protected static _scan ( string $path, array $options, $dirFlags, $iteratorFlags ) : array
$path string Path or paths to scan.
$options array Scanning options. Possible values are: -`'iterator'` _integer_ : The iterator mode. -`'skipDots'` _boolean_ : Keeps '.' and '..' if `true`. -`'leavesOnly'` _boolean_ : Keeps only leaves if `true`. -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`. -`'recursive'` _boolean_ : Scans recursively if `true`. -`'include'` _string|array_: An array of includes. -`'exclude'` _string|array_: An array of excludes. -`'type'` _string|array_: An array of types.
return array

accept() public method

Checks if a file passes the setted filters.
public accept ( ) : boolean
return boolean

copy() public static method

Copies a directory.
public static copy ( array | string $path, string $dest, array $options = [] ) : array
$path array | string Source directory.
$dest string Destination directory.
$options array Scanning options. Possible values are: -`'mode'` _integer_ : Mode used for directory creation. -`'childrenOnly'` _boolean_ : Excludes parent directory if `true`. -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`. -`'recursive'` _boolean_ : Scans recursively if `true`.
return array

filter() public method

Applies some filters to a FilterIterator instance.
public filter ( array $options = [] )
$options array The filters optoins. Possible values are: -`'include'` _string|array_: An array of includes. -`'exclude'` _string|array_: An array of excludes. -`'type'` _string|array_: An array of types.

make() public static method

Creates a directory.
public static make ( array | string $path, array $options = [] ) : boolean
$path array | string The directory path.
$options array Possible options values are: -`'mode'` _integer_ : Mode used for directory creation. -`'recursive'` _boolean_ : Scans recursively if `true`.
return boolean

remove() public static method

Removes one or many directories.
public static remove ( array | string $path, array $options = [] )
$path array | string Path or paths to scan.
$options array Scanning options. Possible values are: -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`. -`'recursive'` _boolean_ : Scans recursively if `true`.

scan() public static method

Scans one or many directories for files.
public static scan ( array | string $path, array $options = [] ) : array
$path array | string Path or paths to scan.
$options array Scanning options. Possible values are: -`'iterator'` _integer_ : The iterator mode. -`'skipDots'` _boolean_ : Keeps '.' and '..' if `true`. -`'leavesOnly'` _boolean_ : Keeps only leaves if `true`. -`'followSymlinks'` _boolean_ : Follows Symlinks if `true`. -`'recursive'` _boolean_ : Scans recursively if `true`. -`'include'` _string|array_: An array of includes. -`'exclude'` _string|array_: An array of excludes. -`'type'` _string|array_: An array of types.
return array

tempnam() public static method

Creates a directory with unique file name.
See also: http://php.net/manual/en/function.tempnam.php
public static tempnam ( string $path = null, string $prefix = '' ) : string
$path string The directory where the temporary filename will be created.
$prefix string The prefix of the generated temporary filename.
return string

Property Details

$_exclude protected_oe property

List of exclude patterns
protected array $_exclude
return array

$_include protected_oe property

List of include patterns
protected array $_include
return array

$_types protected_oe property

List of allowed types
protected array $_types
return array