class Finder implements IteratorAggregate

Finder allows searching through directory trees using iterator.

Finder::findFiles('*.php') ->size('> 10kB') ->from('.') ->exclude('temp');

Methods

__construct()

No description

static Finder
find(string ...$masks)

Begins search for files and directories matching mask.

static Finder
findFiles(string ...$masks)

Begins search for files matching mask.

static Finder
findDirectories(string ...$masks)

Begins search for directories matching mask.

files(string ...$masks)

Begins search for files matching mask.

directories(string ...$masks)

Begins search for directories matching mask.

in(string ...$paths)

Searches in the given folder(s).

from(string ...$paths)

Searches recursively from the given folder(s).

childFirst()

Shows folder content prior to the folder.

ignoreUnreadableDirs(bool $state = true)

No description

sortByName(bool $state = true)

No description

and()

Starts defining a new search group.

exclude(string ...$masks)

Restricts the search using mask.

filter(callable $callback)

Restricts the search using callback.

recurseFilter(callable $callback)

Restricts the search using callback.

limitDepth(int|null $depth)

Limits recursion level.

size(string $operator, int|null $size = null)

Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB

date(string $operator, string|int|DateTimeInterface|null $date = null)

Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23

array
toArray()

No description

getIterator()

No description

Details

at line 38
__construct()

No description

at line 48
static Finder find(string ...$masks)

Begins search for files and directories matching mask.

Parameters

string ...$masks

Return Value

Finder

at line 59
static Finder findFiles(string ...$masks)

Begins search for files matching mask.

Parameters

string ...$masks

Return Value

Finder

at line 70
static Finder findDirectories(string ...$masks)

Begins search for directories matching mask.

Parameters

string ...$masks

Return Value

Finder

at line 80
Finder files(string ...$masks)

Begins search for files matching mask.

Parameters

string ...$masks

Return Value

Finder

at line 100
Finder directories(string ...$masks)

Begins search for directories matching mask.

Parameters

string ...$masks

Return Value

Finder

at line 121
Finder in(string ...$paths)

Searches in the given folder(s).

Parameters

string ...$paths

Return Value

Finder

at line 140
Finder from(string ...$paths)

Searches recursively from the given folder(s).

Parameters

string ...$paths

Return Value

Finder

at line 158
Finder childFirst()

Shows folder content prior to the folder.

Return Value

Finder

at line 165
Finder ignoreUnreadableDirs(bool $state = true)

No description

Parameters

bool $state

Return Value

Finder

at line 172
Finder sortByName(bool $state = true)

No description

Parameters

bool $state

Return Value

Finder

at line 182
Finder and()

Starts defining a new search group.

Return Value

Finder

at line 196
Finder exclude(string ...$masks)

Restricts the search using mask.

Parameters

string ...$masks

Return Value

Finder

at line 227
Finder filter(callable $callback)

Restricts the search using callback.

Parameters

callable $callback

Return Value

Finder

at line 238
Finder recurseFilter(callable $callback)

Restricts the search using callback.

Parameters

callable $callback

Return Value

Finder

at line 248
Finder limitDepth(int|null $depth)

Limits recursion level.

Parameters

int|null $depth

Return Value

Finder

at line 258
Finder size(string $operator, int|null $size = null)

Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB

Parameters

string $operator
int|null $size

Return Value

Finder

at line 278
Finder date(string $operator, string|int|DateTimeInterface|null $date = null)

Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23

Parameters

string $operator
string|int|DateTimeInterface|null $date

Return Value

Finder

at line 297
array toArray()

No description

Return Value

array

at line 304
Generator getIterator()

No description

Return Value

Generator

Traits

Strict class for better experience.