function RepeatedField::offsetUnset
Remove the element at the given index.
This will also be called for: unset($arr)
@todo need to add return type void (require update php version to 7.1)
Parameters
integer $offset The index of the element to be removed.:
Return value
void
Throws
\ErrorException Invalid type for index.
\ErrorException The element to be removed is not at the end of the RepeatedField.
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ RepeatedField.php, line 195
Class
- RepeatedField
- RepeatedField is used by generated protocol message classes to manipulate repeated fields. It can be used like native PHP array.
Namespace
Google\Protobuf\InternalCode
public function offsetUnset($offset) {
$count = count($this->container);
if (!is_numeric($offset) || $count === 0 || $offset < 0 || $offset >= $count) {
trigger_error("Cannot remove element at the given index", E_USER_ERROR);
return;
}
array_splice($this->container, $offset, 1);
}