Debian Codegraph @

php/src/Google/Protobuf/NullValue.php

raw
1 <?php
2 # Generated by the protocol buffer compiler. DO NOT EDIT!
3 # source: google/protobuf/struct.proto
4
5 namespace Google\Protobuf;
6
7 use UnexpectedValueException;
8
9 /**
10 * `NullValue` is a singleton enumeration to represent the null value for the
11 * `Value` type union.
12 * The JSON representation for `NullValue` is JSON `null`.
13 *
14 * Protobuf type <code>google.protobuf.NullValue</code>
15 */
16 class NullValue
17 {
18 /**
19 * Null value.
20 *
21 * Generated from protobuf enum <code>NULL_VALUE = 0;</code>
22 */
23 const NULL_VALUE = 0;
24
25 private static $valueToName = [
26 self::NULL_VALUE => 'NULL_VALUE',
27 ];
28
29 public static function name($value)
30 {
31 if (!isset(self::$valueToName[$value])) {
32 throw new UnexpectedValueException(sprintf(
33 'Enum %s has no name defined for value %s', __CLASS__, $value));
34 }
35 return self::$valueToName[$value];
36 }
37
38
39 public static function value($name)
40 {
41 $const = __CLASS__ . '::' . strtoupper($name);
42 if (!defined($const)) {
43 throw new UnexpectedValueException(sprintf(
44 'Enum %s has no value defined for name %s', __CLASS__, $name));
45 }
46 return constant($const);
47 }
48 }
49