TypedMapInterface
interface TypedMapInterface implements MapInterface (View source)
A TypedMapInterface
represents a map of elements where key and value are
typed.
Methods
Returns true
if this map contains a mapping for the specified key.
Returns true
if this map maps one or more keys to the specified value.
Returns the value to which the specified key is mapped, null
if this
map contains no mapping for the key, or (optionally) $defaultValue
if
this map contains no mapping for the key.
Associates the specified value with the specified key in this map.
Associates the specified value with the specified key in this map only if it is not already set.
Removes the mapping for a key from this map if it is present.
Removes the entry for the specified key only if it is currently mapped to the specified value.
Replaces the entry for the specified key only if it is currently mapped to some value.
Replaces the entry for the specified key only if currently mapped to the specified value.
Return the type used on the key.
Return the type forced on the values.
Details
in ArrayInterface at line 29
void
clear()
Removes all items from this array.
in ArrayInterface at line 36
array
toArray()
Returns a native PHP array representation of this array object.
in ArrayInterface at line 43
bool
isEmpty()
Returns true
if this array is empty.
in MapInterface at line 33
bool
containsKey(mixed $key)
Returns true
if this map contains a mapping for the specified key.
in MapInterface at line 44
bool
containsValue(mixed $value)
Returns true
if this map maps one or more keys to the specified value.
This performs a strict type check on the value.
in MapInterface at line 51
array
keys()
Return an array of the keys contained in this map.
in MapInterface at line 63
mixed|null
get(mixed $key, mixed $defaultValue = null)
Returns the value to which the specified key is mapped, null
if this
map contains no mapping for the key, or (optionally) $defaultValue
if
this map contains no mapping for the key.
in MapInterface at line 77
mixed|null
put(mixed $key, mixed $value)
Associates the specified value with the specified key in this map.
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
in MapInterface at line 92
mixed|null
putIfAbsent(mixed $key, mixed $value)
Associates the specified value with the specified key in this map only if it is not already set.
If there is already a value associated with $key
, this returns that
value without replacing it.
in MapInterface at line 102
mixed|null
remove(mixed $key)
Removes the mapping for a key from this map if it is present.
in MapInterface at line 115
bool
removeIf(mixed $key, mixed $value)
Removes the entry for the specified key only if it is currently mapped to the specified value.
This performs a strict type check on the value.
in MapInterface at line 127
mixed|null
replace(mixed $key, mixed $value)
Replaces the entry for the specified key only if it is currently mapped to some value.
in MapInterface at line 141
bool
replaceIf(mixed $key, mixed $oldValue, mixed $newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
This performs a strict type check on the value.
at line 28
string
getKeyType()
Return the type used on the key.
at line 35
string
getValueType()
Return the type forced on the values.