function Message::parseFieldFromStream
@ignore
1 call to Message::parseFieldFromStream()
- Message::parseFromStream in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 472
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 parseFieldFromStream($tag, $input, $field) {
$value = null;
if (is_null($field)) {
$value_format = GPBWire::UNKNOWN;
}
elseif (GPBWire::getTagWireType($tag) === GPBWire::getWireType($field->getType())) {
$value_format = GPBWire::NORMAL_FORMAT;
}
elseif ($field->isPackable() && GPBWire::getTagWireType($tag) === GPBWire::WIRETYPE_LENGTH_DELIMITED) {
$value_format = GPBWire::PACKED_FORMAT;
}
else {
// the wire type doesn't match. Put it in our unknown field set.
$value_format = GPBWire::UNKNOWN;
}
if ($value_format === GPBWire::UNKNOWN) {
$this->skipField($input, $tag);
return;
}
elseif ($value_format === GPBWire::NORMAL_FORMAT) {
self::parseFieldFromStreamNoTag($input, $field, $value);
}
elseif ($value_format === GPBWire::PACKED_FORMAT) {
$length = 0;
if (!GPBWire::readInt32($input, $length)) {
throw new GPBDecodeException("Unexpected EOF inside packed length.");
}
$limit = $input->pushLimit($length);
$getter = $field->getGetter();
while ($input->bytesUntilLimit() > 0) {
self::parseFieldFromStreamNoTag($input, $field, $value);
$this->appendHelper($field, $value);
}
$input->popLimit($limit);
return;
}
else {
return;
}
if ($field->isMap()) {
$this->kvUpdateHelper($field, $value->getKey(), $value->getValue());
}
else {
if ($field->isRepeated()) {
$this->appendHelper($field, $value);
}
else {
$setter = $field->getSetter();
$this->{$setter}($value);
}
}
}