interface TypedMapInterface implements MapInterface (View source)

A TypedMapInterface represents a map of elements where key and value are typed.

Methods

void
clear()

Removes all items from this array.

array
toArray()

Returns a native PHP array representation of this array object.

bool
isEmpty()

Returns true if this array is empty.

bool
containsKey(mixed $key)

Returns true if this map contains a mapping for the specified key.

bool
containsValue(mixed $value)

Returns true if this map maps one or more keys to the specified value.

array
keys()

Return an array of the keys contained in this map.

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.

mixed|null
put(mixed $key, mixed $value)

Associates the specified value with the specified key in this map.

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.

mixed|null
remove(mixed $key)

Removes the mapping for a key from this map if it is present.

bool
removeIf(mixed $key, mixed $value)

Removes the entry for the specified key only if it is currently mapped to the specified value.

mixed|null
replace(mixed $key, mixed $value)

Replaces the entry for the specified key only if it is currently mapped to some value.

bool
replaceIf(mixed $key, mixed $oldValue, mixed $newValue)

Replaces the entry for the specified key only if currently mapped to the specified value.

string
getKeyType()

Return the type used on the key.

string
getValueType()

Return the type forced on the values.

Details

void clear()

Removes all items from this array.

Return Value

void

array toArray()

Returns a native PHP array representation of this array object.

Return Value

array

bool isEmpty()

Returns true if this array is empty.

Return Value

bool

bool containsKey(mixed $key)

Returns true if this map contains a mapping for the specified key.

Parameters

mixed $key The key to check in the map.

Return Value

bool

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.

Parameters

mixed $value The value to check in the map.

Return Value

bool

array keys()

Return an array of the keys contained in this map.

Return Value

array

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.

Parameters

mixed $key The key to return from the map.
mixed $defaultValue The default value to use if $key is not found.

Return Value

mixed|null the value or null if the key could not be found.

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.

Parameters

mixed $key The key to put or replace in the map.
mixed $value The value to store at $key.

Return Value

mixed|null the previous value associated with key, or null if there was no mapping for $key.

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.

Parameters

mixed $key The key to put in the map.
mixed $value The value to store at $key.

Return Value

mixed|null the previous value associated with key, or null if there was no mapping for $key.

mixed|null remove(mixed $key)

Removes the mapping for a key from this map if it is present.

Parameters

mixed $key The key to remove from the map.

Return Value

mixed|null the previous value associated with key, or null if there was no mapping for $key.

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.

Parameters

mixed $key The key to remove from the map.
mixed $value The value to match.

Return Value

bool true if the value was removed.

mixed|null replace(mixed $key, mixed $value)

Replaces the entry for the specified key only if it is currently mapped to some value.

Parameters

mixed $key The key to replace.
mixed $value The value to set at $key.

Return Value

mixed|null the previous value associated with key, or null if there was no mapping for $key.

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.

Parameters

mixed $key The key to remove from the map.
mixed $oldValue The value to match.
mixed $newValue The value to use as a replacement.

Return Value

bool true if the value was replaced.

string getKeyType()

Return the type used on the key.

Return Value

string

string getValueType()

Return the type forced on the values.

Return Value

string