function Message::serializeRepeatedFieldToStream
@ignore
1 call to Message::serializeRepeatedFieldToStream()
- Message::serializeFieldToStream in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 1341
Class
- Message
- Parent class of all proto messages. Users should not instantiate this class or extend this class or its child classes by their own. See the comment of specific functions for more details.
Namespace
Google\Protobuf\InternalCode
private function serializeRepeatedFieldToStream($field, &$output) {
$getter = $field->getGetter();
$values = $this->{$getter}();
$count = count($values);
if ($count === 0) {
return true;
}
$packed = $field->getPacked();
if ($packed) {
if (!GPBWire::writeTag($output, GPBWire::makeTag($field->getNumber(), GPBType::STRING))) {
return false;
}
$size = 0;
foreach ($values as $value) {
$size += $this->fieldDataOnlyByteSize($field, $value);
}
if (!$output->writeVarint32($size, true)) {
return false;
}
}
foreach ($values as $value) {
if (!GPBWire::serializeFieldToStream($value, $field, !$packed, $output)) {
return false;
}
}
return true;
}