PHP Class GrumPHP\Collection\FilesCollection

Inheritance: extends Doctrine\Common\Collections\ArrayCollection
Datei anzeigen Open project: phpro/grumphp

Public Methods

Method Description
date ( string $date ) : FilesCollection Adds tests for file dates (last modified).
extensions ( array $extensions ) : FilesCollection
filter ( Closure $closure ) : FilesCollection Filters the iterator with an anonymous function.
filterByFileList ( Traversable $fileList ) : FilesCollection
name ( string | Regex $pattern ) : FilesCollection Adds rules that files must match.
notName ( string $pattern ) : FilesCollection Adds rules that files must match.
notPath ( string $pattern ) : FilesCollection Adds rules that filenames must not match.
path ( string $pattern ) : FilesCollection Filter by path
paths ( array $patterns ) : FilesCollection Filter by paths
size ( string $size ) : FilesCollection Adds tests for file sizes.

Method Details

date() public method

The date must be something that strtotime() is able to parse: $collection->filterByDate('since yesterday'); $collection->filterByDate('until 2 days ago'); $collection->filterByDate('> now - 2 hours'); $collection->filterByDate('>= 2005-10-15');
See also: DateComparator
public date ( string $date ) : FilesCollection
$date string A date to test
return FilesCollection

extensions() public method

public extensions ( array $extensions ) : FilesCollection
$extensions array
return FilesCollection

filter() public method

The anonymous function receives a \SplFileInfo and must return false to remove files.
See also: CustomFilterIterator
public filter ( Closure $closure ) : FilesCollection
$closure Closure An anonymous function
return FilesCollection The current Finder instance

filterByFileList() public method

public filterByFileList ( Traversable $fileList ) : FilesCollection
$fileList Traversable
return FilesCollection

name() public method

You can use patterns (delimited with / sign), globs or simple strings. $collection->name('*.php') $collection->name('/\.php$/') // same as above $collection->name('test.php')
public name ( string | Regex $pattern ) : FilesCollection
$pattern string | GrumPHP\Util\Regex A pattern (a regexp, a glob, or a string)
return FilesCollection

notName() public method

You can use patterns (delimited with / sign), globs or simple strings. $collection->name('*.php') $collection->name('/\.php$/') // same as above $collection->name('test.php')
public notName ( string $pattern ) : FilesCollection
$pattern string A pattern (a regexp, a glob, or a string)
return FilesCollection

notPath() public method

You can use patterns (delimited with / sign) or simple strings. $collection->notPath('/^spec\/')
public notPath ( string $pattern ) : FilesCollection
$pattern string
return FilesCollection

path() public method

$collection->path('/^spec\/')
public path ( string $pattern ) : FilesCollection
$pattern string
return FilesCollection

paths() public method

$collection->paths(['/^spec\/','/^src\/'])
public paths ( array $patterns ) : FilesCollection
$patterns array
return FilesCollection

size() public method

$collection->filterBySize('> 10K'); $collection->filterBySize('<= 1Ki'); $collection->filterBySize(4);
See also: NumberComparator
public size ( string $size ) : FilesCollection
$size string A size range string
return FilesCollection