Pair
class Pair implements JsonSerializable (View source)
A pair is used by Ds\Map to pair keys with values.
Properties
TKey | $key | ||
TValue | $value |
Methods
__construct(TKey $key = null, TValue $value = null)
Creates a new instance using a given key and value.
clear()
Removes all values from the pair.
bool
isEmpty()
Returns whether the pair is empty.
array
toArray()
Converts the pair to an array.
mixed
jsonSerialize()
Specify data which should be serialized to JSON
Details
__construct(TKey $key = null, TValue $value = null)
Creates a new instance using a given key and value.
clear()
Removes all values from the pair.
Pair
copy()
Returns a shallow copy of the pair.
bool
isEmpty()
Returns whether the pair is empty.
array
toArray()
Converts the pair to an array.
Note: Casting to an array is not supported yet.
mixed
jsonSerialize()
Specify data which should be serialized to JSON