• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.Type</code>
11 */
12class Type
13{
14    /**
15     * 0 is reserved for errors.
16     * Order is weird for historical reasons.
17     *
18     * Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
19     */
20    const TYPE_DOUBLE = 1;
21    /**
22     * Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
23     */
24    const TYPE_FLOAT = 2;
25    /**
26     * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
27     * negative values are likely.
28     *
29     * Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
30     */
31    const TYPE_INT64 = 3;
32    /**
33     * Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
34     */
35    const TYPE_UINT64 = 4;
36    /**
37     * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
38     * negative values are likely.
39     *
40     * Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
41     */
42    const TYPE_INT32 = 5;
43    /**
44     * Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
45     */
46    const TYPE_FIXED64 = 6;
47    /**
48     * Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
49     */
50    const TYPE_FIXED32 = 7;
51    /**
52     * Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
53     */
54    const TYPE_BOOL = 8;
55    /**
56     * Generated from protobuf enum <code>TYPE_STRING = 9;</code>
57     */
58    const TYPE_STRING = 9;
59    /**
60     * Tag-delimited aggregate.
61     * Group type is deprecated and not supported in proto3. However, Proto3
62     * implementations should still be able to parse the group wire format and
63     * treat group fields as unknown fields.
64     *
65     * Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
66     */
67    const TYPE_GROUP = 10;
68    /**
69     * Length-delimited aggregate.
70     *
71     * Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
72     */
73    const TYPE_MESSAGE = 11;
74    /**
75     * New in version 2.
76     *
77     * Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
78     */
79    const TYPE_BYTES = 12;
80    /**
81     * Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
82     */
83    const TYPE_UINT32 = 13;
84    /**
85     * Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
86     */
87    const TYPE_ENUM = 14;
88    /**
89     * Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
90     */
91    const TYPE_SFIXED32 = 15;
92    /**
93     * Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
94     */
95    const TYPE_SFIXED64 = 16;
96    /**
97     * Uses ZigZag encoding.
98     *
99     * Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
100     */
101    const TYPE_SINT32 = 17;
102    /**
103     * Uses ZigZag encoding.
104     *
105     * Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
106     */
107    const TYPE_SINT64 = 18;
108
109    private static $valueToName = [
110        self::TYPE_DOUBLE => 'TYPE_DOUBLE',
111        self::TYPE_FLOAT => 'TYPE_FLOAT',
112        self::TYPE_INT64 => 'TYPE_INT64',
113        self::TYPE_UINT64 => 'TYPE_UINT64',
114        self::TYPE_INT32 => 'TYPE_INT32',
115        self::TYPE_FIXED64 => 'TYPE_FIXED64',
116        self::TYPE_FIXED32 => 'TYPE_FIXED32',
117        self::TYPE_BOOL => 'TYPE_BOOL',
118        self::TYPE_STRING => 'TYPE_STRING',
119        self::TYPE_GROUP => 'TYPE_GROUP',
120        self::TYPE_MESSAGE => 'TYPE_MESSAGE',
121        self::TYPE_BYTES => 'TYPE_BYTES',
122        self::TYPE_UINT32 => 'TYPE_UINT32',
123        self::TYPE_ENUM => 'TYPE_ENUM',
124        self::TYPE_SFIXED32 => 'TYPE_SFIXED32',
125        self::TYPE_SFIXED64 => 'TYPE_SFIXED64',
126        self::TYPE_SINT32 => 'TYPE_SINT32',
127        self::TYPE_SINT64 => 'TYPE_SINT64',
128    ];
129
130    public static function name($value)
131    {
132        if (!isset(self::$valueToName[$value])) {
133            throw new UnexpectedValueException(sprintf(
134                    'Enum %s has no name defined for value %s', __CLASS__, $value));
135        }
136        return self::$valueToName[$value];
137    }
138
139
140    public static function value($name)
141    {
142        $const = __CLASS__ . '::' . strtoupper($name);
143        if (!defined($const)) {
144            throw new UnexpectedValueException(sprintf(
145                    'Enum %s has no value defined for name %s', __CLASS__, $name));
146        }
147        return constant($const);
148    }
149}
150
151// Adding a class alias for backwards compatibility with the previous class name.
152class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class);
153
154