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

Breadcrumb

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

function MessageBuilderContext::getFieldDescriptor

3 calls to MessageBuilderContext::getFieldDescriptor()
MessageBuilderContext::optional in vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php
MessageBuilderContext::repeated in vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php
MessageBuilderContext::required in vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php

File

vendor/google/protobuf/src/Google/Protobuf/Internal/MessageBuilderContext.php, line 31

Class

MessageBuilderContext

Namespace

Google\Protobuf\Internal

Code

private function getFieldDescriptor($name, $label, $type, $number, $type_name = null) {
    $field = new FieldDescriptor();
    $field->setName($name);
    $camel_name = implode('', array_map('ucwords', explode('_', $name)));
    $field->setGetter('get' . $camel_name);
    $field->setSetter('set' . $camel_name);
    $field->setType($type);
    $field->setNumber($number);
    $field->setLabel($label);
    // At this time, the message/enum type may have not been added to pool.
    // So we use the type name as place holder and will replace it with the
    // actual descriptor in cross building.
    switch ($type) {
        case GPBType::MESSAGE:
            $field->setMessageType($type_name);
            break;
        case GPBType::ENUM:
            $field->setEnumType($type_name);
            break;
        default:
            break;
    }
    return $field;
}

API Navigation

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