$attributes
$attributes :
Collection of data attributes
RouteCollection
A DataCollection for Routes
keys(array $mask = null, boolean $fill_with_nulls = true) : array
Returns all of the key names in the collection
If an optional mask array is passed, this only returns the keys that match the mask
array | $mask | The parameter mask array |
boolean | $fill_with_nulls | Whether or not to fill the returned array with values to match the given mask, even if they don't exist in the collection |
all(array $mask = null, boolean $fill_with_nulls = true) : array
Returns all of the attributes in the collection
If an optional mask array is passed, this only returns the keys that match the mask
array | $mask | The parameter mask array |
boolean | $fill_with_nulls | Whether or not to fill the returned array with values to match the given mask, even if they don't exist in the collection |
set(string $key, \app\framework\Component\Route\Klein\Route|callable $value) : \app\framework\Component\Route\Klein\DataCollection\RouteCollection
Set a 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"
string | $key | The name of the route to set |
\app\framework\Component\Route\Klein\Route|callable | $value | The value of the route to set |
replace(array $attributes = array()) : \app\framework\Component\Route\Klein\DataCollection\DataCollection
Replace the collection's attributes
array | $attributes | The attributes to replace the collection's with |
merge(array $attributes = array(), boolean $hard = false) : \app\framework\Component\Route\Klein\DataCollection\DataCollection
Merge attributes with the collection's attributes
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
array | $attributes | The attributes to merge into the collection |
boolean | $hard | Whether or not to make the merge "hard" |
clear() : \app\framework\Component\Route\Klein\DataCollection\DataCollection
Clear the collection's contents
Semantic alias of a no-argument $this->replace
call
cloneEmpty() : \app\framework\Component\Route\Klein\DataCollection\DataCollection
A quick convenience method to get an empty clone of the collection. Great for dependency injection. :)
addRoute(\app\framework\Component\Route\Klein\Route $route) : \app\framework\Component\Route\Klein\DataCollection\RouteCollection
Add a route instance to the collection
This will auto-generate a name
\app\framework\Component\Route\Klein\Route | $route |
add(\app\framework\Component\Route\Klein\Route|callable $route) : \app\framework\Component\Route\Klein\DataCollection\RouteCollection
Add a route to the collection
This allows a more generic form that will take a Route instance, string callable or any other Route class compatible callback
\app\framework\Component\Route\Klein\Route|callable | $route |
prepareNamed() : \app\framework\Component\Route\Klein\DataCollection\RouteCollection
Prepare the named routes in the collection
This loops through every route to set the collection's key name for that route to equal the routes name, if its changed
Thankfully, because routes are all objects, this doesn't take much memory as its simply moving references around