Reference documentation and code samples for the proto library Client class MapField.
MapField is used by generated protocol message classes to manipulate map fields. It can be used like native PHP array.
Namespace
Google \ Protobuf \ InternalImplements
Methods
offsetGet
Return the element at the given key.
This will also be called for: $ele = $arr[$key]
| Parameter | |
|---|---|
| Name | Description |
key |
int|string
The key of the element to be fetched. |
| Returns | |
|---|---|
| Type | Description |
object |
The stored element at given key. |
offsetSet
Assign the element at the given key.
This will also be called for: $arr[$key] = $value
| Parameters | |
|---|---|
| Name | Description |
key |
int|string
The key of the element to be fetched. |
value |
object
The element to be assigned. |
| Returns | |
|---|---|
| Type | Description |
void |
|
offsetUnset
Remove the element at the given key.
This will also be called for: unset($arr)
| Parameter | |
|---|---|
| Name | Description |
key |
int|string
The key of the element to be removed. |
| Returns | |
|---|---|
| Type | Description |
void |
|
offsetExists
Check the existence of the element at the given key.
This will also be called for: isset($arr)
| Parameter | |
|---|---|
| Name | Description |
key |
int|string
The key of the element to be removed. |
| Returns | |
|---|---|
| Type | Description |
bool |
True if the element at the given key exists. |
count
Return the number of stored elements.
This will also be called for: count($arr)
| Returns | |
|---|---|
| Type | Description |
int |
The number of stored elements. |