1ffe3c632Sopenharmony_ci<?php 2ffe3c632Sopenharmony_ci# Generated by the protocol buffer compiler. DO NOT EDIT! 3ffe3c632Sopenharmony_ci# source: google/protobuf/type.proto 4ffe3c632Sopenharmony_ci 5ffe3c632Sopenharmony_cinamespace Google\Protobuf; 6ffe3c632Sopenharmony_ci 7ffe3c632Sopenharmony_ciuse UnexpectedValueException; 8ffe3c632Sopenharmony_ci 9ffe3c632Sopenharmony_ci/** 10ffe3c632Sopenharmony_ci * The syntax in which a protocol buffer element is defined. 11ffe3c632Sopenharmony_ci * 12ffe3c632Sopenharmony_ci * Protobuf type <code>google.protobuf.Syntax</code> 13ffe3c632Sopenharmony_ci */ 14ffe3c632Sopenharmony_ciclass Syntax 15ffe3c632Sopenharmony_ci{ 16ffe3c632Sopenharmony_ci /** 17ffe3c632Sopenharmony_ci * Syntax `proto2`. 18ffe3c632Sopenharmony_ci * 19ffe3c632Sopenharmony_ci * Generated from protobuf enum <code>SYNTAX_PROTO2 = 0;</code> 20ffe3c632Sopenharmony_ci */ 21ffe3c632Sopenharmony_ci const SYNTAX_PROTO2 = 0; 22ffe3c632Sopenharmony_ci /** 23ffe3c632Sopenharmony_ci * Syntax `proto3`. 24ffe3c632Sopenharmony_ci * 25ffe3c632Sopenharmony_ci * Generated from protobuf enum <code>SYNTAX_PROTO3 = 1;</code> 26ffe3c632Sopenharmony_ci */ 27ffe3c632Sopenharmony_ci const SYNTAX_PROTO3 = 1; 28ffe3c632Sopenharmony_ci 29ffe3c632Sopenharmony_ci private static $valueToName = [ 30ffe3c632Sopenharmony_ci self::SYNTAX_PROTO2 => 'SYNTAX_PROTO2', 31ffe3c632Sopenharmony_ci self::SYNTAX_PROTO3 => 'SYNTAX_PROTO3', 32ffe3c632Sopenharmony_ci ]; 33ffe3c632Sopenharmony_ci 34ffe3c632Sopenharmony_ci public static function name($value) 35ffe3c632Sopenharmony_ci { 36ffe3c632Sopenharmony_ci if (!isset(self::$valueToName[$value])) { 37ffe3c632Sopenharmony_ci throw new UnexpectedValueException(sprintf( 38ffe3c632Sopenharmony_ci 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39ffe3c632Sopenharmony_ci } 40ffe3c632Sopenharmony_ci return self::$valueToName[$value]; 41ffe3c632Sopenharmony_ci } 42ffe3c632Sopenharmony_ci 43ffe3c632Sopenharmony_ci public static function value($name) 44ffe3c632Sopenharmony_ci { 45ffe3c632Sopenharmony_ci $const = __CLASS__ . '::' . strtoupper($name); 46ffe3c632Sopenharmony_ci if (!defined($const)) { 47ffe3c632Sopenharmony_ci throw new UnexpectedValueException(sprintf( 48ffe3c632Sopenharmony_ci 'Enum %s has no value defined for name %s', __CLASS__, $name)); 49ffe3c632Sopenharmony_ci } 50ffe3c632Sopenharmony_ci return constant($const); 51ffe3c632Sopenharmony_ci } 52ffe3c632Sopenharmony_ci} 53ffe3c632Sopenharmony_ci 54