PathLocator
class PathLocator implements PathLocatorInterface, IteratorAggregate (View source)
A Path locator class
Methods
Constructor to handle path.
Replace with a new path.
Get file iterator of current dir.
Get folder iterator of current dir.
Get file iterator of current dir
Find one file and return.
Find all files which matches condition.
Using a closure function to filter file.
Detect is current path a dir?
Detect is current path a file?
Detect is current path exists?
Set a prefix, when this object convert to string, prefix will auto add to the front of path.
Get a child path of given name.
Get a parent path of given condition.
Append a new path before current path.
Append a new path before current path.
Is this path subdir of given path?
Convert this object to string.
Details
at line line 51
__construct(string $path)
Constructor to handle path.
at line line 65
PathLocator
redirect(string $path)
Replace with a new path.
at line line 79
FilesystemIterator|RecursiveIteratorIterator
getIterator(boolean $recursive = false)
Get file iterator of current dir.
at line line 92
CallbackFilterIterator
getFolders(boolean $recursive = false)
Get folder iterator of current dir.
at line line 104
CallbackFilterIterator
getFiles(boolean $recursive = false)
Get file iterator of current dir
at line line 126
SplFileInfo
findOne(mixed $condition, boolean $recursive = false)
Find one file and return.
at line line 148
CallbackFilterIterator
find(mixed $condition, boolean $recursive = false)
Find all files which matches condition.
at line line 164
CallbackFilterIterator
findByCallback(Closure $callback, boolean $recursive = false)
Using a closure function to filter file.
at line line 271
boolean
isDir()
Detect is current path a dir?
at line line 283
boolean
isFile()
Detect is current path a file?
at line line 295
boolean
exists()
Detect is current path exists?
at line line 310
PathLocator
setPrefix(string $prefix = '')
Set a prefix, when this object convert to string, prefix will auto add to the front of path.
at line line 326
PathLocator
child(string $name)
Get a child path of given name.
at line line 344
PathLocator
parent(boolean $condition = null)
Get a parent path of given condition.
at line line 397
PathLocator
append(string $path)
Append a new path before current path.
at line line 420
PathLocator
prepend(string $path)
Append a new path before current path.
at line line 443
boolean
isSubdirOf(string $parent)
Is this path subdir of given path?
at line line 471
string
__toString()
Convert this object to string.