RouteCollection
A DataCollection for Routes
uses | \Klein\DataCollection\DataCollection |
---|---|
package | Klein\DataCollection |
__construct(array $routes)
override | (doesn't call our parent) |
---|---|
access | public |
array
The routes of this collection
__get(string $key) : mixed
Allows the ability to arbitrarily request an attribute from this instance while treating it as an instance property
see | \Klein\DataCollection\get() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::__get() |
string
The name of the parameter to return
mixed
__isset(string $key) : boolean
Allows the ability to arbitrarily check the existence of an attribute from this instance while treating it as an instance property
see | \Klein\DataCollection\exists() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::__isset() |
string
The name of the parameter
boolean
__set(string $key, mixed $value) : void
Allows the ability to arbitrarily set an attribute from this instance while treating it as an instance property
see | \Klein\DataCollection\set() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::__set() |
string
The name of the parameter to set
mixed
The value of the parameter to set
__unset(string $key) : void
Allows the ability to arbitrarily remove an attribute from this instance while treating it as an instance property
see | \Klein\DataCollection\remove() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::__unset() |
string
The name of the parameter
add(mixed $route) : \Klein\Route
This allows a more generic form that will take a Route instance, string callable or any other Route class compatible callback
access | public |
---|
mixed
all(array $mask, boolean $fill_with_nulls) : array
If an optional mask array is passed, this only returns the keys that match the mask
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::all() |
array
The parameter mask array
boolean
Whether or not to fill the returned array with null values to match the given mask
array
count() : int
Allows the use of the "count" function (or any internal counters) to simply count the number of attributes in the collection.
see | \Countable::count() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::count() |
int
exists(string $key) : boolean
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::exists() |
string
The name of the parameter
boolean
get(string $key, mixed $default_val) : mixed
Return a default value if the key doesn't exist
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::get() |
string
The name of the parameter to return
mixed
The default value of the parameter if it contains no value
mixed
getIterator() : \ArrayIterator
IteratorAggregate interface required method
see | \IteratorAggregate::getIterator() |
---|---|
access | public |
inherited_from | \Klein\DataCollection\DataCollection::getIterator() |
merge(array $attributes, boolean $hard) : \Klein\DataCollection\DataCollection
Optionally allows a second boolean parameter to merge the attributes into the collection in a "hard" manner, using the "array_replace" method instead of the usual "array_merge" method
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::merge() |
array
The attributes to merge into the collection
boolean
Whether or not to make the merge "hard"
offsetExists(string $key) : boolean
Allows the access of attributes of this instance while treating it like an array
see | \ArrayAccess::offsetExists() |
---|---|
see | \Klein\DataCollection\exists() |
access | public |
inherited_from | \Klein\DataCollection\DataCollection::offsetExists() |
string
The name of the parameter
boolean
offsetGet(string $key) : mixed
Allows the access of attributes of this instance while treating it like an array
see | \ArrayAccess::offsetGet() |
---|---|
see | \Klein\DataCollection\get() |
access | public |
inherited_from | \Klein\DataCollection\DataCollection::offsetGet() |
string
The name of the parameter to return
mixed
offsetSet(string $key, mixed $value) : void
Allows the access of attributes of this instance while treating it like an array
see | \ArrayAccess::offsetSet() |
---|---|
see | \Klein\DataCollection\set() |
access | public |
inherited_from | \Klein\DataCollection\DataCollection::offsetSet() |
string
The name of the parameter to set
mixed
The value of the parameter to set
offsetUnset(string $key) : void
Allows the access of attributes of this instance while treating it like an array
see | \ArrayAccess::offsetUnset() |
---|---|
see | \Klein\DataCollection\remove() |
access | public |
inherited_from | \Klein\DataCollection\DataCollection::offsetUnset() |
string
The name of the parameter
remove(string $key) : void
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::remove() |
string
The name of the parameter
replace(array $attributes) : \Klein\DataCollection\DataCollection
access | public |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::replace() |
array
The attributes to replace the collection's with
set(string $key, \Klein\Route | callable $value) : \Klein\Route
A value may either be a callable or a Route instance Callable values will be converted into a Route with the "name" of the route being set from the "key"
A developer may add a named route to the collection by passing the name of the route as the "$key" and an instance of a Route as the "$value"
see | \Klein\DataCollection\DataCollection::set() |
---|---|
access | public |
string
The name of the route to set
$attributes : array
access | protected |
---|---|
inherited_from | \Klein\DataCollection\DataCollection::$$attributes |