PluginProbe
Plausible Analytics / trunk
Plausible Analytics vtrunk
2.6.1 2.6.0 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 52 releases
plausible-analytics / src / Client / lib / Model / TrackerScriptConfiguration.php

TrackerScriptConfiguration.php in Plausible Analytics trunk, at src/Client/lib/Model/TrackerScriptConfiguration.php

414 lines 10.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TrackerScriptConfiguration
4 *
5 * PHP version 7.4
6 *
7 * @category Class
8 * @package Plausible\Analytics\WP\Client
9 * @author OpenAPI Generator team
10 * @link https://openapi-generator.tech
11 */
12
13 /**
14 * Plausible Plugins API
15 *
16 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
17 *
18 * The version of the OpenAPI document: 1.0-rc
19 * Generated by: https://openapi-generator.tech
20 * OpenAPI Generator version: 7.0.1
21 */
22
23 /**
24 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25 * https://openapi-generator.tech
26 * Do not edit the class manually.
27 */
28
29 namespace Plausible\Analytics\WP\Client\Model;
30
31 use \ArrayAccess;
32 use \Plausible\Analytics\WP\Client\ObjectSerializer;
33
34 /**
35 * TrackerScriptConfiguration Class Doc Comment
36 *
37 * @category Class
38 * @description Tracker Script Configuration object
39 * @package Plausible\Analytics\WP\Client
40 * @author OpenAPI Generator team
41 * @link https://openapi-generator.tech
42 * @implements \ArrayAccess<string, mixed>
43 */
44 class TrackerScriptConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable
45 {
46 public const DISCRIMINATOR = null;
47
48 /**
49 * The original name of the model.
50 *
51 * @var string
52 */
53 protected static $openAPIModelName = 'TrackerScriptConfiguration';
54
55 /**
56 * Array of property to type mappings. Used for (de)serialization
57 *
58 * @var string[]
59 */
60 protected static $openAPITypes = [
61 'tracker_script_configuration' => '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration'
62 ];
63
64 /**
65 * Array of property to format mappings. Used for (de)serialization
66 *
67 * @var string[]
68 * @phpstan-var array<string, string|null>
69 * @psalm-var array<string, string|null>
70 */
71 protected static $openAPIFormats = [
72 'tracker_script_configuration' => null
73 ];
74
75 /**
76 * Array of nullable properties. Used for (de)serialization
77 *
78 * @var boolean[]
79 */
80 protected static array $openAPINullables = [
81 'tracker_script_configuration' => false
82 ];
83
84 /**
85 * If a nullable field gets set to null, insert it here
86 *
87 * @var boolean[]
88 */
89 protected array $openAPINullablesSetToNull = [];
90
91 /**
92 * Array of property to type mappings. Used for (de)serialization
93 *
94 * @return array
95 */
96 public static function openAPITypes()
97 {
98 return self::$openAPITypes;
99 }
100
101 /**
102 * Array of property to format mappings. Used for (de)serialization
103 *
104 * @return array
105 */
106 public static function openAPIFormats()
107 {
108 return self::$openAPIFormats;
109 }
110
111 /**
112 * Array of nullable properties
113 *
114 * @return array
115 */
116 protected static function openAPINullables(): array
117 {
118 return self::$openAPINullables;
119 }
120
121 /**
122 * Array of nullable field names deliberately set to null
123 *
124 * @return boolean[]
125 */
126 private function getOpenAPINullablesSetToNull(): array
127 {
128 return $this->openAPINullablesSetToNull;
129 }
130
131 /**
132 * Setter - Array of nullable field names deliberately set to null
133 *
134 * @param boolean[] $openAPINullablesSetToNull
135 */
136 private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
137 {
138 $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
139 }
140
141 /**
142 * Checks if a property is nullable
143 *
144 * @param string $property
145 * @return bool
146 */
147 public static function isNullable(string $property): bool
148 {
149 return self::openAPINullables()[$property] ?? false;
150 }
151
152 /**
153 * Checks if a nullable property is set to null.
154 *
155 * @param string $property
156 * @return bool
157 */
158 public function isNullableSetToNull(string $property): bool
159 {
160 return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
161 }
162
163 /**
164 * Array of attributes where the key is the local name,
165 * and the value is the original name
166 *
167 * @var string[]
168 */
169 protected static $attributeMap = [
170 'tracker_script_configuration' => 'tracker_script_configuration'
171 ];
172
173 /**
174 * Array of attributes to setter functions (for deserialization of responses)
175 *
176 * @var string[]
177 */
178 protected static $setters = [
179 'tracker_script_configuration' => 'setTrackerScriptConfiguration'
180 ];
181
182 /**
183 * Array of attributes to getter functions (for serialization of requests)
184 *
185 * @var string[]
186 */
187 protected static $getters = [
188 'tracker_script_configuration' => 'getTrackerScriptConfiguration'
189 ];
190
191 /**
192 * Array of attributes where the key is the local name,
193 * and the value is the original name
194 *
195 * @return array
196 */
197 public static function attributeMap()
198 {
199 return self::$attributeMap;
200 }
201
202 /**
203 * Array of attributes to setter functions (for deserialization of responses)
204 *
205 * @return array
206 */
207 public static function setters()
208 {
209 return self::$setters;
210 }
211
212 /**
213 * Array of attributes to getter functions (for serialization of requests)
214 *
215 * @return array
216 */
217 public static function getters()
218 {
219 return self::$getters;
220 }
221
222 /**
223 * The original name of the model.
224 *
225 * @return string
226 */
227 public function getModelName()
228 {
229 return self::$openAPIModelName;
230 }
231
232
233 /**
234 * Associative array for storing property values
235 *
236 * @var mixed[]
237 */
238 protected $container = [];
239
240 /**
241 * Constructor
242 *
243 * @param mixed[]|null $data Associated array of property values
244 * initializing the model
245 */
246 public function __construct( ?array $data = null )
247 {
248 $this->setIfExists('tracker_script_configuration', $data ?? [], null);
249 }
250
251 /**
252 * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
253 * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
254 * $this->openAPINullablesSetToNull array
255 *
256 * @param string $variableName
257 * @param array $fields
258 * @param mixed $defaultValue
259 */
260 private function setIfExists(string $variableName, array $fields, $defaultValue): void
261 {
262 if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
263 $this->openAPINullablesSetToNull[] = $variableName;
264 }
265
266 $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
267 }
268
269 /**
270 * Show all the invalid properties with reasons.
271 *
272 * @return array invalid properties with reasons
273 */
274 public function listInvalidProperties()
275 {
276 $invalidProperties = [];
277
278 if ($this->container['tracker_script_configuration'] === null) {
279 $invalidProperties[] = "'tracker_script_configuration' can't be null";
280 }
281 return $invalidProperties;
282 }
283
284 /**
285 * Validate all the properties in the model
286 * return true if all passed
287 *
288 * @return bool True if all properties are valid
289 */
290 public function valid()
291 {
292 return count($this->listInvalidProperties()) === 0;
293 }
294
295
296 /**
297 * Gets tracker_script_configuration
298 *
299 * @return \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration
300 */
301 public function getTrackerScriptConfiguration()
302 {
303 return $this->container['tracker_script_configuration'];
304 }
305
306 /**
307 * Sets tracker_script_configuration
308 *
309 * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration $tracker_script_configuration tracker_script_configuration
310 *
311 * @return self
312 */
313 public function setTrackerScriptConfiguration($tracker_script_configuration)
314 {
315 if (is_null($tracker_script_configuration)) {
316 throw new \InvalidArgumentException('non-nullable tracker_script_configuration cannot be null');
317 }
318 $this->container['tracker_script_configuration'] = $tracker_script_configuration;
319
320 return $this;
321 }
322 /**
323 * Returns true if offset exists. False otherwise.
324 *
325 * @param integer $offset Offset
326 *
327 * @return boolean
328 */
329 public function offsetExists($offset): bool
330 {
331 return isset($this->container[$offset]);
332 }
333
334 /**
335 * Gets offset.
336 *
337 * @param integer $offset Offset
338 *
339 * @return mixed|null
340 */
341 #[\ReturnTypeWillChange]
342 public function offsetGet($offset)
343 {
344 return $this->container[$offset] ?? null;
345 }
346
347 /**
348 * Sets value based on offset.
349 *
350 * @param int|null $offset Offset
351 * @param mixed $value Value to be set
352 *
353 * @return void
354 */
355 public function offsetSet($offset, $value): void
356 {
357 if (is_null($offset)) {
358 $this->container[] = $value;
359 } else {
360 $this->container[$offset] = $value;
361 }
362 }
363
364 /**
365 * Unsets offset.
366 *
367 * @param integer $offset Offset
368 *
369 * @return void
370 */
371 public function offsetUnset($offset): void
372 {
373 unset($this->container[$offset]);
374 }
375
376 /**
377 * Serializes the object to a value that can be serialized natively by json_encode().
378 * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
379 *
380 * @return mixed Returns data which can be serialized by json_encode(), which is a value
381 * of any type other than a resource.
382 */
383 #[\ReturnTypeWillChange]
384 public function jsonSerialize()
385 {
386 return ObjectSerializer::sanitizeForSerialization($this);
387 }
388
389 /**
390 * Gets the string presentation of the object
391 *
392 * @return string
393 */
394 public function __toString()
395 {
396 return json_encode(
397 ObjectSerializer::sanitizeForSerialization($this),
398 JSON_PRETTY_PRINT
399 );
400 }
401
402 /**
403 * Gets a header-safe presentation of the object
404 *
405 * @return string
406 */
407 public function toHeaderValue()
408 {
409 return json_encode(ObjectSerializer::sanitizeForSerialization($this));
410 }
411 }
412
413
414