FileAccess Orion

TypedMapInterface extends MapInterface

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

Table of Contents

clear()  : void
Removes all items from this array.
containsKey()  : bool
Returns `true` if this map contains a mapping for the specified key.
containsValue()  : bool
Returns `true` if this map maps one or more keys to the specified value.
get()  : mixed|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.
getKeyType()  : string
Return the type used on the key.
getValueType()  : string
Return the type forced on the values.
isEmpty()  : bool
Returns `true` if this array is empty.
keys()  : array<string|int, mixed>
Return an array of the keys contained in this map.
put()  : mixed|null
Associates the specified value with the specified key in this map.
putIfAbsent()  : mixed|null
Associates the specified value with the specified key in this map only if it is not already set.
remove()  : mixed|null
Removes the mapping for a key from this map if it is present.
removeIf()  : bool
Removes the entry for the specified key only if it is currently mapped to the specified value.
replace()  : mixed|null
Replaces the entry for the specified key only if it is currently mapped to some value.
replaceIf()  : bool
Replaces the entry for the specified key only if currently mapped to the specified value.
toArray()  : array<string|int, mixed>
Returns a native PHP array representation of this array object.

Methods

clear()

Removes all items from this array.

public clear() : void
Return values
void —

containsKey()

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

public containsKey(mixed $key) : bool
Parameters
$key : mixed

The key to check in the map.

Return values
bool —

containsValue()

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

public containsValue(mixed $value) : bool

This performs a strict type check on the value.

Parameters
$value : mixed

The value to check in the map.

Return values
bool —

get()

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.

public get(mixed $key[, mixed $defaultValue = null ]) : mixed|null
Parameters
$key : mixed

The key to return from the map.

$defaultValue : mixed = null

The default value to use if $key is not found.

Return values
mixed|null —

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

getKeyType()

Return the type used on the key.

public getKeyType() : string
Return values
string —

getValueType()

Return the type forced on the values.

public getValueType() : string
Return values
string —

isEmpty()

Returns `true` if this array is empty.

public isEmpty() : bool
Return values
bool —

keys()

Return an array of the keys contained in this map.

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed> —

put()

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

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

If the map previously contained a mapping for the key, the old value is replaced by the specified value.

Parameters
$key : mixed

The key to put or replace in the map.

$value : mixed

The value to store at $key.

Return values
mixed|null —

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

putIfAbsent()

Associates the specified value with the specified key in this map only if it is not already set.

public putIfAbsent(mixed $key, mixed $value) : mixed|null

If there is already a value associated with $key, this returns that value without replacing it.

Parameters
$key : mixed

The key to put in the map.

$value : mixed

The value to store at $key.

Return values
mixed|null —

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

remove()

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

public remove(mixed $key) : mixed|null
Parameters
$key : mixed

The key to remove from the map.

Return values
mixed|null —

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

removeIf()

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

public removeIf(mixed $key, mixed $value) : bool

This performs a strict type check on the value.

Parameters
$key : mixed

The key to remove from the map.

$value : mixed

The value to match.

Return values
bool —

true if the value was removed.

replace()

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

public replace(mixed $key, mixed $value) : mixed|null
Parameters
$key : mixed

The key to replace.

$value : mixed

The value to set at $key.

Return values
mixed|null —

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

replaceIf()

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

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

This performs a strict type check on the value.

Parameters
$key : mixed

The key to remove from the map.

$oldValue : mixed

The value to match.

$newValue : mixed

The value to use as a replacement.

Return values
bool —

true if the value was replaced.

toArray()

Returns a native PHP array representation of this array object.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —

Search results