• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?php
2# Generated by the protocol buffer compiler.  DO NOT EDIT!
3# source: google/protobuf/struct.proto
4
5namespace Google\Protobuf;
6
7use 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 */
16class 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    public static function value($name)
39    {
40        $const = __CLASS__ . '::' . strtoupper($name);
41        if (!defined($const)) {
42            throw new UnexpectedValueException(sprintf(
43                    'Enum %s has no value defined for name %s', __CLASS__, $name));
44        }
45        return constant($const);
46    }
47}
48
49