PHP Class GrumPHP\Collection\FilesCollection

Inheritance: extends Doctrine\Common\Collections\ArrayCollection
Afficher le fichier Open project: phpro/grumphp

Méthodes publiques

Méthode 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 méthode

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
Résultat FilesCollection

extensions() public méthode

public extensions ( array $extensions ) : FilesCollection
$extensions array
Résultat FilesCollection

filter() public méthode

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
Résultat FilesCollection The current Finder instance

filterByFileList() public méthode

public filterByFileList ( Traversable $fileList ) : FilesCollection
$fileList Traversable
Résultat FilesCollection

name() public méthode

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)
Résultat FilesCollection

notName() public méthode

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)
Résultat FilesCollection

notPath() public méthode

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

path() public méthode

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

paths() public méthode

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

size() public méthode

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