MapWrap<Tk,Tv>
Provides convenience methods for getting values out of maps.
Constructors / Destructors
| Returns | Signature and Description |
|---|---|
void | __construct()Creates a new MapWrap. |
Instance Methods
| Returns | Signature and Description |
|---|---|
bool | containsKey()Whether the delegate map contains the key. |
?Tv | get()Convenience method that delegates the Map's get |
ConstMap<Tk,Tv> | getMap()Gets the original delegate map. |
mixed | nested()Gets a value in nested maps. |
MapWrap<arraykey,mixed> | nestedw()Gets a MapWrap in nested maps. |
Map<Tk,Tv> | sub()Looks for a Map at the given key; automatically converts arrays. |
MapWrap<Tk,Tv> | subw()Looks for a MapWrap at the given key; automatically converts arrays. |
string | trim()Gets a value as a trimmed string. |
Method Details
__construct
__construct(?KeyedTraversable<Tk,Tv> $map)Creates a new MapWrap.
| Name | Type | Description |
|---|---|---|
$map | ?KeyedTraversable<Tk,Tv> | The Map to wrap |
containsKey
containsKey(Tk $key)Whether the delegate map contains the key.
| Name | Type | Description |
|---|---|---|
$key | Tk | The key |
| Type | Description |
|---|---|
bool | Whether this value is contained |
get
get(Tk $key)Convenience method that delegates the Map's get
| Name | Type | Description |
|---|---|---|
$key | Tk |
| Type | Description |
|---|---|
?Tv | The value found (or null) |
getMap
getMap()Gets the original delegate map.
| Type | Description |
|---|---|
ConstMap<Tk,Tv> | The original delegate map |
nested
nested(string $key)Gets a value in nested maps.
| Name | Type | Description |
|---|---|---|
$key | string | The dot-separated key |
| Type | Description |
|---|---|
mixed | The nested value |
nestedw
nestedw(string $key)Gets a MapWrap in nested maps.
| Name | Type | Description |
|---|---|---|
$key | string | The dot-separated key |
| Type | Description |
|---|---|
MapWrap<arraykey,mixed> | The nested MapWrap |
sub
sub(Tk $key)Looks for a Map at the given key; automatically converts arrays.
| Name | Type | Description |
|---|---|---|
$key | Tk | The key |
| Type | Description |
|---|---|
Map<Tk,Tv> | A map (potentially empty) |
subw
subw(Tk $key)Looks for a MapWrap at the given key; automatically converts arrays.
| Name | Type | Description |
|---|---|---|
$key | Tk | The key |
| Type | Description |
|---|---|
MapWrap<Tk,Tv> | A MapWrap (potentially empty) |
trim
trim(Tk $key)Gets a value as a trimmed string.
| Name | Type | Description |
|---|---|---|
$key | Tk | The key |
| Type | Description |
|---|---|
string | A trimmed string |