function Message::existField
@ignore
5 calls to Message::existField()
- Message::fieldByteSize in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
- Message::fieldJsonByteSize in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
- Message::jsonByteSize in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
- Message::serializeSingularFieldToStream in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
- Message::serializeToJsonStream in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 1561
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 existField($field) {
$getter = $field->getGetter();
$hazzer = "has" . substr($getter, 3);
if (method_exists($this, $hazzer)) {
return $this->{$hazzer}();
}
else {
if ($field->getOneofIndex() !== -1) {
// For old generated code, which does not have hazzers for oneof
// fields.
$oneof = $this->desc
->getOneofDecl()[$field->getOneofIndex()];
$oneof_name = $oneof->getName();
return $this->{$oneof_name}
->getNumber() === $field->getNumber();
}
}
$values = $this->{$getter}();
if ($field->isMap()) {
return count($values) !== 0;
}
elseif ($field->isRepeated()) {
return count($values) !== 0;
}
else {
return $values !== $this->defaultValue($field);
}
}