Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Message.php

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\Internal

Code

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);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal