• 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    /**
61     * Represents a null value.
62     *
63     * Generated from protobuf field <code>.google.protobuf.NullValue null_value = 1;</code>
64     * @param int $var
65     * @return $this
66     */
67    public function setNullValue($var)
68    {
69        GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class);
70        $this->writeOneof(1, $var);
71
72        return $this;
73    }
74
75    /**
76     * Represents a double value.
77     *
78     * Generated from protobuf field <code>double number_value = 2;</code>
79     * @return float
80     */
81    public function getNumberValue()
82    {
83        return $this->readOneof(2);
84    }
85
86    /**
87     * Represents a double value.
88     *
89     * Generated from protobuf field <code>double number_value = 2;</code>
90     * @param float $var
91     * @return $this
92     */
93    public function setNumberValue($var)
94    {
95        GPBUtil::checkDouble($var);
96        $this->writeOneof(2, $var);
97
98        return $this;
99    }
100
101    /**
102     * Represents a string value.
103     *
104     * Generated from protobuf field <code>string string_value = 3;</code>
105     * @return string
106     */
107    public function getStringValue()
108    {
109        return $this->readOneof(3);
110    }
111
112    /**
113     * Represents a string value.
114     *
115     * Generated from protobuf field <code>string string_value = 3;</code>
116     * @param string $var
117     * @return $this
118     */
119    public function setStringValue($var)
120    {
121        GPBUtil::checkString($var, True);
122        $this->writeOneof(3, $var);
123
124        return $this;
125    }
126
127    /**
128     * Represents a boolean value.
129     *
130     * Generated from protobuf field <code>bool bool_value = 4;</code>
131     * @return bool
132     */
133    public function getBoolValue()
134    {
135        return $this->readOneof(4);
136    }
137
138    /**
139     * Represents a boolean value.
140     *
141     * Generated from protobuf field <code>bool bool_value = 4;</code>
142     * @param bool $var
143     * @return $this
144     */
145    public function setBoolValue($var)
146    {
147        GPBUtil::checkBool($var);
148        $this->writeOneof(4, $var);
149
150        return $this;
151    }
152
153    /**
154     * Represents a structured value.
155     *
156     * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
157     * @return \Google\Protobuf\Struct
158     */
159    public function getStructValue()
160    {
161        return $this->readOneof(5);
162    }
163
164    /**
165     * Represents a structured value.
166     *
167     * Generated from protobuf field <code>.google.protobuf.Struct struct_value = 5;</code>
168     * @param \Google\Protobuf\Struct $var
169     * @return $this
170     */
171    public function setStructValue($var)
172    {
173        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
174        $this->writeOneof(5, $var);
175
176        return $this;
177    }
178
179    /**
180     * Represents a repeated `Value`.
181     *
182     * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
183     * @return \Google\Protobuf\ListValue
184     */
185    public function getListValue()
186    {
187        return $this->readOneof(6);
188    }
189
190    /**
191     * Represents a repeated `Value`.
192     *
193     * Generated from protobuf field <code>.google.protobuf.ListValue list_value = 6;</code>
194     * @param \Google\Protobuf\ListValue $var
195     * @return $this
196     */
197    public function setListValue($var)
198    {
199        GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class);
200        $this->writeOneof(6, $var);
201
202        return $this;
203    }
204
205    /**
206     * @return string
207     */
208    public function getKind()
209    {
210        return $this->whichOneof("kind");
211    }
212
213}
214
215