media-cloud-sync
/
includes
/
sdk
/
google
/
google
/
protobuf
/
src
/
Google
/
Protobuf
/
OneofDescriptor.php
OneofDescriptor.php in Media Cloud Sync 1.0.1, at includes/sdk/google/google/protobuf/src/Google/Protobuf/OneofDescriptor.php
| 1 | <?php |
| 2 | |
| 3 | // Protocol Buffers - Google's data interchange format |
| 4 | // Copyright 2017 Google Inc. All rights reserved. |
| 5 | // |
| 6 | // Use of this source code is governed by a BSD-style |
| 7 | // license that can be found in the LICENSE file or at |
| 8 | // https://developers.google.com/open-source/licenses/bsd |
| 9 | namespace Dudlewebs\WPMCS\Google\Protobuf; |
| 10 | |
| 11 | use Dudlewebs\WPMCS\Google\Protobuf\Internal\GetPublicDescriptorTrait; |
| 12 | class OneofDescriptor |
| 13 | { |
| 14 | use GetPublicDescriptorTrait; |
| 15 | /** @var \Google\Protobuf\Internal\OneofDescriptor $internal_desc */ |
| 16 | private $internal_desc; |
| 17 | /** |
| 18 | * @internal |
| 19 | */ |
| 20 | public function __construct($internal_desc) |
| 21 | { |
| 22 | $this->internal_desc = $internal_desc; |
| 23 | } |
| 24 | /** |
| 25 | * @return string The name of the oneof |
| 26 | */ |
| 27 | public function getName() |
| 28 | { |
| 29 | return $this->internal_desc->getName(); |
| 30 | } |
| 31 | /** |
| 32 | * @param int $index Must be >= 0 and < getFieldCount() |
| 33 | * @return FieldDescriptor |
| 34 | */ |
| 35 | public function getField($index) |
| 36 | { |
| 37 | if (is_null($this->internal_desc->getFields()) || !isset($this->internal_desc->getFields()[$index])) { |
| 38 | return null; |
| 39 | } |
| 40 | return $this->getPublicDescriptor($this->internal_desc->getFields()[$index]); |
| 41 | } |
| 42 | /** |
| 43 | * @return int Number of fields in the oneof |
| 44 | */ |
| 45 | public function getFieldCount() |
| 46 | { |
| 47 | return count($this->internal_desc->getFields()); |
| 48 | } |
| 49 | public function isSynthetic() |
| 50 | { |
| 51 | return $this->internal_desc->isSynthetic(); |
| 52 | } |
| 53 | } |
| 54 |