• 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 Google\Protobuf\Internal\GPBType;
8use Google\Protobuf\Internal\RepeatedField;
9use Google\Protobuf\Internal\GPBUtil;
10
11/**
12 * `Value` represents a dynamically typed value which can be either
13 * null, a number, a string, a boolean, a recursive struct value, or a
14 * list of values. A producer of value is expected to set one of that
15 * variants, absence of any variant indicates an error.
16 * The JSON representation for `Value` is JSON value.
17 *
18 * Generated from protobuf message <code>google.protobuf.Value</code>
19 */
20class Value extends \Google\Protobuf\Internal\Message
21{
22    protected $kind;
23
24    /**
25     * Constructor.
26     *
27     * @param array $data {
28     *     Optional. Data for populating the Message object.
29     *
30     *     @type int $null_value
31     *           Represents a null value.
32     *     @type float $number_value
33     *           Represents a double value.
34     *     @type string $string_value
35     *           Represents a string value.
36     *     @type bool $bool_value
37     *           Represents a boolean value.
38     *     @type \Google\Protobuf\Struct $struct_value
39     *           Represents a structured value.
40     *     @type \Google\Protobuf\ListValue $list_value
41     *           Represents a repeated `Value`.
42     * }
43     */
44    public function __construct($data = NULL) {
45        \GPBMetadata\Google\Protobuf\Struct::initOnce();
46        parent::__construct($data);
47    }
48
49    /**
50     * Represents a null value.
51     *
52     * Generated from protobuf field <code>.google.protobuf.NullValue null_value = 1;</code>
53     * @return int
54     */
55    public function getNullValue()
56    {
57        return $this->readOneof(1);
58    }
59
60    public function hasNullValue()
61    {
62        return $this->hasOneof(1);
63    }
64
65    /**
66     * Represents a null value.
67     *
68     * Generated from protobuf field <code>.google.protobuf.NullValue null_value = 1;</code>
69     * @param int $var
70     * @return $this
71     */
72    public function setNullValue($var)
73    {
74        GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class);
75        $this->writeOneof(1, $var);
76
77        return $this;
78    }
79
80    /**
81     * Represents a double value.
82     *
83     * Generated from protobuf field <code>double number_value = 2;</code>
84     * @return float
85     */
86    public function getNumberValue()
87    {
88        return $this->readOneof(2);
89    }
90
91    public function hasNumberValue()
92    {
93        return $this->hasOneof(2);
94    }
95
96    /**
97     * Represents a double value.
98     *
99     * Generated from protobuf field <code>double number_value = 2;</code>
100     * @param float $var
101     * @return $this
102     */
103    public function setNumberValue($var)
104    {
105        GPBUtil::checkDouble($var);
106        $this->writeOneof(2, $var);
107
108        return $this;
109    }
110
111    /**
112     * Represents a string value.
113     *
114     * Generated from protobuf field <code>string string_value = 3;</code>
115     * @return string
116     */
117    public function getStringValue()
118    {
119        return $this->readOneof(3);
120    }
121
122    public function hasStringValue()
123    {
124        return $this->hasOneof(3);
125    }
126
127    /**
128     * Represents a string value.
129     *
130     * Generated from protobuf field <code>string string_value = 3;</code>
131     * @param string $var
132     * @return $this
133     */
134    public function setStringValue($var)
135    {
136        GPBUtil::checkString($var, True);
137        $this->writeOneof(3, $var);
138
139        return $this;
140    }
141
142    /**
143     * Represents a boolean value.
144     *
145     * Generated from protobuf field <code>bool bool_value = 4;</code>
146     * @return bool
147     */
148    public function getBoolValue()
149    {
150        return $this->readOneof(4);
151    }
152
153    public function hasBoolValue()
154    {
155        return $this->hasOneof(4);
156    }
157
158    /**
159     * Represents a boolean value.
160     *
161     * Generated from protobuf field <code>bool bool_value = 4;</code>
162     * @param bool $var
163     * @return $this
164     */
165    public function setBoolValue($var)
166    {
167        GPBUtil::checkBool($var);
168        $this->writeOneof(4, $var);
169
170        return $this;
171    }
172
173    /**
174     * Represents a structured value.
175     *
176     * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
177     * @return \Google\Protobuf\Struct
178     */
179    public function getStructValue()
180    {
181        return $this->readOneof(5);
182    }
183
184    public function hasStructValue()
185    {
186        return $this->hasOneof(5);
187    }
188
189    /**
190     * Represents a structured value.
191     *
192     * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
193     * @param \Google\Protobuf\Struct $var
194     * @return $this
195     */
196    public function setStructValue($var)
197    {
198        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
199        $this->writeOneof(5, $var);
200
201        return $this;
202    }
203
204    /**
205     * Represents a repeated `Value`.
206     *
207     * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
208     * @return \Google\Protobuf\ListValue
209     */
210    public function getListValue()
211    {
212        return $this->readOneof(6);
213    }
214
215    public function hasListValue()
216    {
217        return $this->hasOneof(6);
218    }
219
220    /**
221     * Represents a repeated `Value`.
222     *
223     * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
224     * @param \Google\Protobuf\ListValue $var
225     * @return $this
226     */
227    public function setListValue($var)
228    {
229        GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class);
230        $this->writeOneof(6, $var);
231
232        return $this;
233    }
234
235    /**
236     * @return string
237     */
238    public function getKind()
239    {
240        return $this->whichOneof("kind");
241    }
242
243}
244
245