class MapField implements ArrayAccess, IteratorAggregate, Countable (View source)
MapField is used by generated protocol message classes to manipulate map fields. It can be used like native PHP array.
Methods
Constructs an instance of MapField.
No description
No description
No description
No description
Return the element at the given key.
Assign the element at the given key.
Remove the element at the given key.
Check the existence of the element at the given key.
No description
Return the number of stored elements.
Details
__construct(long $key_type, long $value_type, string $klass = null)
Constructs an instance of MapField.
getKeyType()
No description
getValueType()
No description
getValueClass()
No description
getLegacyValueClass()
No description
object offsetGet(int|string $key)
Return the element at the given key.
This will also be called for: $ele = $arr[$key]
need to add return type mixed (require update php version to 8.0)
void offsetSet(int|string $key, object $value)
Assign the element at the given key.
This will also be called for: $arr[$key] = $value
need to add return type void (require update php version to 7.1)
void offsetUnset(int|string $key)
Remove the element at the given key.
This will also be called for: unset($arr)
need to add return type void (require update php version to 7.1)
bool offsetExists(int|string $key)
Check the existence of the element at the given key.
This will also be called for: isset($arr)
Traversable getIterator()
No description
int count()
Return the number of stored elements.
This will also be called for: count($arr)