PathCollection
class PathCollection extends ArrayObject (View source)
A PathLocator collection class
Constants
STD_PROP_LIST |
Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.). |
ARRAY_AS_PROPS |
Entries can be accessed as properties (read and write). |
Methods
PathCollection constructor.
Sets the value at the specified key to value
Sort an array using a case insensitive "natural order" algorithm
Sets the value at the specified key to value
Sets the iterator classname for the ArrayObject
Sort the entries with a user-defined comparison function and maintain key association
Sort the entries by keys using a user-defined comparison function
Batch add paths to bag.
Add one path to bag.
Using key to remove a path from bag.
Get all paths with key from bag.
Using key to get a path.
Get all files and folders as an iterator.
Find one file from all paths.
Find all files from paths.
Get file iterator of all paths
Get folder iterator of all paths
Set prefix to all paths.
Append a new path to all paths.
Prepend a new path to all paths.
Convert paths bag to array, and every path to string.
Details
at line line 41
__construct(array $paths = array())
PathCollection constructor.
in ArrayObject at line line 72
boolean
__isset(mixed $key)
Returns whether the requested key exists
in ArrayObject at line line 96
void|mixed
__set(mixed $key, mixed $value)
Sets the value at the specified key to value
in ArrayObject at line line 119
void|mixed
__unset(mixed $key)
Unsets the value at the specified key
in ArrayObject at line line 142
mixed
__get(mixed $key)
Returns the value at the specified key by reference
in ArrayObject at line line 168
void
append(mixed $value)
Appends the value
in ArrayObject at line line 178
void
asort()
Sort the entries by value
in ArrayObject at line line 188
int
count()
Get the number of public properties in the ArrayObject
in ArrayObject at line line 201
array
exchangeArray(array|ArrayObject $data)
Exchange the array for another one.
in ArrayObject at line line 230
array
getArrayCopy()
Creates a copy of the ArrayObject.
in ArrayObject at line line 240
int
getFlags()
Gets the behavior flags.
in ArrayObject at line line 250
Iterator
getIterator()
Create a new iterator from an ArrayObject instance
in ArrayObject at line line 262
string
getIteratorClass()
Gets the iterator classname for the ArrayObject.
in ArrayObject at line line 272
void
ksort()
Sort the entries by key
in ArrayObject at line line 282
void
natcasesort()
Sort an array using a case insensitive "natural order" algorithm
in ArrayObject at line line 292
void
natsort()
Sort entries using a "natural order" algorithm
in ArrayObject at line line 304
bool
offsetExists(mixed $key)
Returns whether the requested key exists
in ArrayObject at line line 316
mixed
offsetGet(mixed $key)
Returns the value at the specified key
in ArrayObject at line line 338
void
offsetSet(mixed $key, mixed $value)
Sets the value at the specified key to value
in ArrayObject at line line 350
void
offsetUnset(mixed $key)
Unsets the value at the specified key
in ArrayObject at line line 363
string
serialize()
Serialize an ArrayObject
in ArrayObject at line line 375
void
setFlags(int $flags)
Sets the behavior flags
in ArrayObject at line line 388
void
setIteratorClass(string $class)
Sets the iterator classname for the ArrayObject
in ArrayObject at line line 419
void
uasort(callable $function)
Sort the entries with a user-defined comparison function and maintain key association
in ArrayObject at line line 434
void
uksort(callable $function)
Sort the entries by keys using a user-defined comparison function
in ArrayObject at line line 449
void
unserialize(string $data)
Unserialize an ArrayObject
at line line 55
PathCollection
addPaths(mixed $paths)
Batch add paths to bag.
at line line 81
PathCollection
addPath(mixed $path, string $key = null)
Add one path to bag.
at line line 121
PathCollection
removePath(string $key)
Using key to remove a path from bag.
at line line 135
array
getPaths()
Get all paths with key from bag.
at line line 152
PathLocator
getPath(string $key, string $default = null)
Using key to get a path.
at line line 214
AppendIterator
getAllChildren(boolean $recursive = false)
Get all files and folders as an iterator.
at line line 241
SplFileInfo
findOne(mixed $condition, boolean $recursive = false)
Find one file from all paths.
at line line 272
AppendIterator
find(mixed $condition, boolean $recursive = false)
Find all files from paths.
at line line 289
AppendIterator
getFiles(boolean $recursive = false)
Get file iterator of all paths
at line line 306
AppendIterator
getFolders(boolean $recursive = false)
Get folder iterator of all paths
at line line 325
PathCollection
setPrefix(string $prefix)
Set prefix to all paths.
at line line 344
PathCollection
appendAll(string $appended)
Append a new path to all paths.
at line line 363
PathCollection
prependAll(string $prepended)
Prepend a new path to all paths.
at line line 382
array
toArray(bool $reindex = false)
Convert paths bag to array, and every path to string.
at line line 412
boolean
isSubdir(PathLocator $path)
Is this path a subdir of another path in bag?
When running recursive scan dir, we have to avoid to re scan same dir.