1<?php 2# Generated by the protocol buffer compiler. DO NOT EDIT! 3# source: google/protobuf/descriptor.proto 4 5namespace Google\Protobuf\Internal\FieldDescriptorProto; 6 7use UnexpectedValueException; 8 9/** 10 * Protobuf type <code>google.protobuf.FieldDescriptorProto.Label</code> 11 */ 12class Label 13{ 14 /** 15 * 0 is reserved for errors 16 * 17 * Generated from protobuf enum <code>LABEL_OPTIONAL = 1;</code> 18 */ 19 const LABEL_OPTIONAL = 1; 20 /** 21 * Generated from protobuf enum <code>LABEL_REQUIRED = 2;</code> 22 */ 23 const LABEL_REQUIRED = 2; 24 /** 25 * Generated from protobuf enum <code>LABEL_REPEATED = 3;</code> 26 */ 27 const LABEL_REPEATED = 3; 28 29 private static $valueToName = [ 30 self::LABEL_OPTIONAL => 'LABEL_OPTIONAL', 31 self::LABEL_REQUIRED => 'LABEL_REQUIRED', 32 self::LABEL_REPEATED => 'LABEL_REPEATED', 33 ]; 34 35 public static function name($value) 36 { 37 if (!isset(self::$valueToName[$value])) { 38 throw new UnexpectedValueException(sprintf( 39 'Enum %s has no name defined for value %s', __CLASS__, $value)); 40 } 41 return self::$valueToName[$value]; 42 } 43 44 45 public static function value($name) 46 { 47 $const = __CLASS__ . '::' . strtoupper($name); 48 if (!defined($const)) { 49 throw new UnexpectedValueException(sprintf( 50 'Enum %s has no value defined for name %s', __CLASS__, $name)); 51 } 52 return constant($const); 53 } 54} 55 56// Adding a class alias for backwards compatibility with the previous class name. 57class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); 58 59