PHP Class Go\Instrument\FileSystem\Enumerator

Show file Open project: goaop/framework Class Usage Examples

Public Methods

Method Description
__construct ( string $rootDirectory, array $includePaths = [], array $excludePaths = [] ) Initializes an enumerator
enumerate ( ) : CallbackFilterIterator | RecursiveIteratorIterator | SplFileInfo[] Returns an enumerator for files
getFilter ( ) : Closure Returns a filter callback for enumerating files

Protected Methods

Method Description
getFileFullPath ( SplFileInfo $file ) : string Return the real path of the given file

Method Details

__construct() public method

Initializes an enumerator
public __construct ( string $rootDirectory, array $includePaths = [], array $excludePaths = [] )
$rootDirectory string Path to the root directory
$includePaths array List of additional include paths
$excludePaths array List of additional exclude paths

enumerate() public method

Returns an enumerator for files

getFileFullPath() protected method

This is used for testing purpose with virtual file system. In a vfs the 'realPath' methode will always return false. So we have a chance to mock this single function to return different path.
protected getFileFullPath ( SplFileInfo $file ) : string
$file SplFileInfo
return string

getFilter() public method

Returns a filter callback for enumerating files
public getFilter ( ) : Closure
return Closure