\rex_finder

Finder.

Summary

Methods
Properties
Constants
setFactoryClass()
getFactoryClass()
hasFactoryClass()
factory()
recursive()
selfFirst()
childFirst()
filesOnly()
dirsOnly()
ignoreFiles()
ignoreDirs()
ignoreSystemStuff()
sort()
getIterator()
count()
No public properties found
ALL
callFactoryClass()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

ALL

ALL = '__ALL__'

Methods

setFactoryClass()

setFactoryClass(string  $subclass) : mixed

Sets the class for the factory.

Parameters

string $subclass

Classname

Throws

\InvalidArgumentException

Returns

mixed —

getFactoryClass()

getFactoryClass() : string

Returns the class for the factory.

Returns

string —

hasFactoryClass()

hasFactoryClass() : bool

Returns if the class has a custom factory class.

Returns

bool —

factory()

factory(string  $dir) : static

Returns a new finder object.

Parameters

string $dir

Path to a directory

Throws

\InvalidArgumentException

Returns

static —

recursive()

recursive(bool  $recursive = true) : $this

Activate/Deactivate recursive directory scanning.

Parameters

bool $recursive

Returns

$this —

selfFirst()

selfFirst() : $this

Fetch directory contents before recurse its subdirectories.

Returns

$this —

childFirst()

childFirst() : $this

Fetch child directories before their parent directory.

Returns

$this —

filesOnly()

filesOnly() : $this

Fetch files only.

Returns

$this —

dirsOnly()

dirsOnly() : $this

Fetch dirs only.

Returns

$this —

ignoreFiles()

ignoreFiles(string|array  $glob, bool  $recursive = true) : $this

Ignore all files which match the given glob pattern.

Parameters

string|array $glob

Glob pattern or an array of glob patterns

bool $recursive

When FALSE the patterns won't be checked in child directories

Returns

$this —

ignoreDirs()

ignoreDirs(string|array  $glob, bool  $recursive = true) : $this

Ignore all directories which match the given glob pattern.

Parameters

string|array $glob

Glob pattern or an array of glob patterns

bool $recursive

When FALSE the patterns won't be checked in child directories

Returns

$this —

ignoreSystemStuff()

ignoreSystemStuff(bool  $ignoreSystemStuff = true) : $this

Ignores system stuff (like .DS_Store, .svn, .git etc.).

Parameters

bool $ignoreSystemStuff

Returns

$this —

sort()

sort(int|callable  $sort = rex_sortable_iterator::KEYS) : $this

Sorts the elements.

Parameters

int|callable $sort

Sort mode, see {@link}

Returns

$this —

getIterator()

getIterator() : \Traversable|\SplFileInfo[]

Returns

\Traversable|\SplFileInfo[] —

count()

count() : mixed

{@inheritdoc}

Returns

mixed —

callFactoryClass()

callFactoryClass(string  $method, array  $arguments) : mixed

Calls the factory class with the given method and arguments.

Parameters

string $method

Method name

array $arguments

Array of arguments

Returns

mixed —

Result of the callback