PHP Class Psecio\Parse\FileIterator

Inheritance: implements IteratorAggregat\IteratorAggregate, implements Countabl\Countable
Show file Open project: psecio/parse

Public Methods

Method Description
__construct ( array $paths, array $ignorePaths = [], array $extensions = ['php'] ) Append paths to iterator
addExtensions ( array $extensions ) : void Add list of file extensions to include when scanning dirs
addIgnorePath ( string $path ) : void Add a path to the list of ignored paths
addPath ( string $path ) : void Add a path to iterator
count ( ) : integer Return a count of files in iterator
getIterator ( ) : ArrayIterator Get iterator whith file paths as keys and File objects as values
getPaths ( ) : array Get the full paths for the current files
toArray ( ) : array Convert the interator to an array (return current files)

Private Methods

Method Description
addDirectory ( string $directory ) : void Recursicely add files in directory
addFile ( SplFileInfo $splFileInfo ) : void Add a SplFileInfo object to iterator
isValidFile ( SplFileInfo $splFileInfo ) : boolean Check of file should be included

Method Details

__construct() public method

Append paths to iterator
public __construct ( array $paths, array $ignorePaths = [], array $extensions = ['php'] )
$paths array List of paths to scan
$ignorePaths array List of paths to ignore
$extensions array List of file extensions to include when scanning dirs

addExtensions() public method

Add list of file extensions to include when scanning dirs
public addExtensions ( array $extensions ) : void
$extensions array
return void

addIgnorePath() public method

Non existing paths are silently skipped.
public addIgnorePath ( string $path ) : void
$path string
return void

addPath() public method

Add a path to iterator
public addPath ( string $path ) : void
$path string
return void

count() public method

Return a count of files in iterator
public count ( ) : integer
return integer

getIterator() public method

Get iterator whith file paths as keys and File objects as values

getPaths() public method

Get the full paths for the current files
public getPaths ( ) : array
return array Set of file paths

toArray() public method

Convert the interator to an array (return current files)
public toArray ( ) : array
return array Set of current files