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 / TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php

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

587 lines 15.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration
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 * TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration Class Doc Comment
36 *
37 * @category Class
38 * @package Plausible\Analytics\WP\Client
39 * @author OpenAPI Generator team
40 * @link https://openapi-generator.tech
41 * @implements \ArrayAccess<string, mixed>
42 */
43 class TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable
44 {
45 public const DISCRIMINATOR = null;
46
47 /**
48 * The original name of the model.
49 *
50 * @var string
51 */
52 protected static $openAPIModelName = 'TrackerScriptConfiguration_UpdateRequest_tracker_script_configuration';
53
54 /**
55 * Array of property to type mappings. Used for (de)serialization
56 *
57 * @var string[]
58 */
59 protected static $openAPITypes = [
60 'file_downloads' => 'bool',
61 'form_submissions' => 'bool',
62 'hash_based_routing' => 'bool',
63 'installation_type' => 'string',
64 'outbound_links' => 'bool'
65 ];
66
67 /**
68 * Array of property to format mappings. Used for (de)serialization
69 *
70 * @var string[]
71 * @phpstan-var array<string, string|null>
72 * @psalm-var array<string, string|null>
73 */
74 protected static $openAPIFormats = [
75 'file_downloads' => null,
76 'form_submissions' => null,
77 'hash_based_routing' => null,
78 'installation_type' => null,
79 'outbound_links' => null
80 ];
81
82 /**
83 * Array of nullable properties. Used for (de)serialization
84 *
85 * @var boolean[]
86 */
87 protected static array $openAPINullables = [
88 'file_downloads' => false,
89 'form_submissions' => false,
90 'hash_based_routing' => false,
91 'installation_type' => false,
92 'outbound_links' => false
93 ];
94
95 /**
96 * If a nullable field gets set to null, insert it here
97 *
98 * @var boolean[]
99 */
100 protected array $openAPINullablesSetToNull = [];
101
102 /**
103 * Array of property to type mappings. Used for (de)serialization
104 *
105 * @return array
106 */
107 public static function openAPITypes()
108 {
109 return self::$openAPITypes;
110 }
111
112 /**
113 * Array of property to format mappings. Used for (de)serialization
114 *
115 * @return array
116 */
117 public static function openAPIFormats()
118 {
119 return self::$openAPIFormats;
120 }
121
122 /**
123 * Array of nullable properties
124 *
125 * @return array
126 */
127 protected static function openAPINullables(): array
128 {
129 return self::$openAPINullables;
130 }
131
132 /**
133 * Array of nullable field names deliberately set to null
134 *
135 * @return boolean[]
136 */
137 private function getOpenAPINullablesSetToNull(): array
138 {
139 return $this->openAPINullablesSetToNull;
140 }
141
142 /**
143 * Setter - Array of nullable field names deliberately set to null
144 *
145 * @param boolean[] $openAPINullablesSetToNull
146 */
147 private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
148 {
149 $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
150 }
151
152 /**
153 * Checks if a property is nullable
154 *
155 * @param string $property
156 * @return bool
157 */
158 public static function isNullable(string $property): bool
159 {
160 return self::openAPINullables()[$property] ?? false;
161 }
162
163 /**
164 * Checks if a nullable property is set to null.
165 *
166 * @param string $property
167 * @return bool
168 */
169 public function isNullableSetToNull(string $property): bool
170 {
171 return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
172 }
173
174 /**
175 * Array of attributes where the key is the local name,
176 * and the value is the original name
177 *
178 * @var string[]
179 */
180 protected static $attributeMap = [
181 'file_downloads' => 'file_downloads',
182 'form_submissions' => 'form_submissions',
183 'hash_based_routing' => 'hash_based_routing',
184 'installation_type' => 'installation_type',
185 'outbound_links' => 'outbound_links'
186 ];
187
188 /**
189 * Array of attributes to setter functions (for deserialization of responses)
190 *
191 * @var string[]
192 */
193 protected static $setters = [
194 'file_downloads' => 'setFileDownloads',
195 'form_submissions' => 'setFormSubmissions',
196 'hash_based_routing' => 'setHashBasedRouting',
197 'installation_type' => 'setInstallationType',
198 'outbound_links' => 'setOutboundLinks'
199 ];
200
201 /**
202 * Array of attributes to getter functions (for serialization of requests)
203 *
204 * @var string[]
205 */
206 protected static $getters = [
207 'file_downloads' => 'getFileDownloads',
208 'form_submissions' => 'getFormSubmissions',
209 'hash_based_routing' => 'getHashBasedRouting',
210 'installation_type' => 'getInstallationType',
211 'outbound_links' => 'getOutboundLinks'
212 ];
213
214 /**
215 * Array of attributes where the key is the local name,
216 * and the value is the original name
217 *
218 * @return array
219 */
220 public static function attributeMap()
221 {
222 return self::$attributeMap;
223 }
224
225 /**
226 * Array of attributes to setter functions (for deserialization of responses)
227 *
228 * @return array
229 */
230 public static function setters()
231 {
232 return self::$setters;
233 }
234
235 /**
236 * Array of attributes to getter functions (for serialization of requests)
237 *
238 * @return array
239 */
240 public static function getters()
241 {
242 return self::$getters;
243 }
244
245 /**
246 * The original name of the model.
247 *
248 * @return string
249 */
250 public function getModelName()
251 {
252 return self::$openAPIModelName;
253 }
254
255 public const INSTALLATION_TYPE_MANUAL = 'manual';
256 public const INSTALLATION_TYPE_WORDPRESS = 'wordpress';
257 public const INSTALLATION_TYPE_GTM = 'gtm';
258 public const INSTALLATION_TYPE_NPM = 'npm';
259
260 /**
261 * Gets allowable values of the enum
262 *
263 * @return string[]
264 */
265 public function getInstallationTypeAllowableValues()
266 {
267 return [
268 self::INSTALLATION_TYPE_MANUAL,
269 self::INSTALLATION_TYPE_WORDPRESS,
270 self::INSTALLATION_TYPE_GTM,
271 self::INSTALLATION_TYPE_NPM,
272 ];
273 }
274
275 /**
276 * Associative array for storing property values
277 *
278 * @var mixed[]
279 */
280 protected $container = [];
281
282 /**
283 * Constructor
284 *
285 * @param mixed[]|null $data Associated array of property values
286 * initializing the model
287 */
288 public function __construct( ?array $data = null )
289 {
290 $this->setIfExists('file_downloads', $data ?? [], null);
291 $this->setIfExists('form_submissions', $data ?? [], null);
292 $this->setIfExists('hash_based_routing', $data ?? [], null);
293 $this->setIfExists('installation_type', $data ?? [], null);
294 $this->setIfExists('outbound_links', $data ?? [], null);
295 }
296
297 /**
298 * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
299 * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
300 * $this->openAPINullablesSetToNull array
301 *
302 * @param string $variableName
303 * @param array $fields
304 * @param mixed $defaultValue
305 */
306 private function setIfExists(string $variableName, array $fields, $defaultValue): void
307 {
308 if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
309 $this->openAPINullablesSetToNull[] = $variableName;
310 }
311
312 $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
313 }
314
315 /**
316 * Show all the invalid properties with reasons.
317 *
318 * @return array invalid properties with reasons
319 */
320 public function listInvalidProperties()
321 {
322 $invalidProperties = [];
323
324 if ($this->container['installation_type'] === null) {
325 $invalidProperties[] = "'installation_type' can't be null";
326 }
327 $allowedValues = $this->getInstallationTypeAllowableValues();
328 if (!is_null($this->container['installation_type']) && !in_array($this->container['installation_type'], $allowedValues, true)) {
329 $invalidProperties[] = sprintf(
330 "invalid value '%s' for 'installation_type', must be one of '%s'",
331 $this->container['installation_type'],
332 implode("', '", $allowedValues)
333 );
334 }
335
336 return $invalidProperties;
337 }
338
339 /**
340 * Validate all the properties in the model
341 * return true if all passed
342 *
343 * @return bool True if all properties are valid
344 */
345 public function valid()
346 {
347 return count($this->listInvalidProperties()) === 0;
348 }
349
350
351 /**
352 * Gets file_downloads
353 *
354 * @return bool|null
355 */
356 public function getFileDownloads()
357 {
358 return $this->container['file_downloads'];
359 }
360
361 /**
362 * Sets file_downloads
363 *
364 * @param bool|null $file_downloads Track File Downloads
365 *
366 * @return self
367 */
368 public function setFileDownloads($file_downloads)
369 {
370 if (is_null($file_downloads)) {
371 throw new \InvalidArgumentException('non-nullable file_downloads cannot be null');
372 }
373 $this->container['file_downloads'] = $file_downloads;
374
375 return $this;
376 }
377
378 /**
379 * Gets form_submissions
380 *
381 * @return bool|null
382 */
383 public function getFormSubmissions()
384 {
385 return $this->container['form_submissions'];
386 }
387
388 /**
389 * Sets form_submissions
390 *
391 * @param bool|null $form_submissions Track Form Submissions
392 *
393 * @return self
394 */
395 public function setFormSubmissions($form_submissions)
396 {
397 if (is_null($form_submissions)) {
398 throw new \InvalidArgumentException('non-nullable form_submissions cannot be null');
399 }
400 $this->container['form_submissions'] = $form_submissions;
401
402 return $this;
403 }
404
405 /**
406 * Gets hash_based_routing
407 *
408 * @return bool|null
409 */
410 public function getHashBasedRouting()
411 {
412 return $this->container['hash_based_routing'];
413 }
414
415 /**
416 * Sets hash_based_routing
417 *
418 * @param bool|null $hash_based_routing Hash Based Routing
419 *
420 * @return self
421 */
422 public function setHashBasedRouting($hash_based_routing)
423 {
424 if (is_null($hash_based_routing)) {
425 throw new \InvalidArgumentException('non-nullable hash_based_routing cannot be null');
426 }
427 $this->container['hash_based_routing'] = $hash_based_routing;
428
429 return $this;
430 }
431
432 /**
433 * Gets installation_type
434 *
435 * @return string
436 */
437 public function getInstallationType()
438 {
439 return $this->container['installation_type'];
440 }
441
442 /**
443 * Sets installation_type
444 *
445 * @param string $installation_type Tracker Script Installation Type
446 *
447 * @return self
448 */
449 public function setInstallationType($installation_type)
450 {
451 if (is_null($installation_type)) {
452 throw new \InvalidArgumentException('non-nullable installation_type cannot be null');
453 }
454 $allowedValues = $this->getInstallationTypeAllowableValues();
455 if (!in_array($installation_type, $allowedValues, true)) {
456 throw new \InvalidArgumentException(
457 sprintf(
458 "Invalid value '%s' for 'installation_type', must be one of '%s'",
459 $installation_type,
460 implode("', '", $allowedValues)
461 )
462 );
463 }
464 $this->container['installation_type'] = $installation_type;
465
466 return $this;
467 }
468
469 /**
470 * Gets outbound_links
471 *
472 * @return bool|null
473 */
474 public function getOutboundLinks()
475 {
476 return $this->container['outbound_links'];
477 }
478
479 /**
480 * Sets outbound_links
481 *
482 * @param bool|null $outbound_links Track Outbound Links
483 *
484 * @return self
485 */
486 public function setOutboundLinks($outbound_links)
487 {
488 if (is_null($outbound_links)) {
489 throw new \InvalidArgumentException('non-nullable outbound_links cannot be null');
490 }
491 $this->container['outbound_links'] = $outbound_links;
492
493 return $this;
494 }
495 /**
496 * Returns true if offset exists. False otherwise.
497 *
498 * @param integer $offset Offset
499 *
500 * @return boolean
501 */
502 public function offsetExists($offset): bool
503 {
504 return isset($this->container[$offset]);
505 }
506
507 /**
508 * Gets offset.
509 *
510 * @param integer $offset Offset
511 *
512 * @return mixed|null
513 */
514 #[\ReturnTypeWillChange]
515 public function offsetGet($offset)
516 {
517 return $this->container[$offset] ?? null;
518 }
519
520 /**
521 * Sets value based on offset.
522 *
523 * @param int|null $offset Offset
524 * @param mixed $value Value to be set
525 *
526 * @return void
527 */
528 public function offsetSet($offset, $value): void
529 {
530 if (is_null($offset)) {
531 $this->container[] = $value;
532 } else {
533 $this->container[$offset] = $value;
534 }
535 }
536
537 /**
538 * Unsets offset.
539 *
540 * @param integer $offset Offset
541 *
542 * @return void
543 */
544 public function offsetUnset($offset): void
545 {
546 unset($this->container[$offset]);
547 }
548
549 /**
550 * Serializes the object to a value that can be serialized natively by json_encode().
551 * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
552 *
553 * @return mixed Returns data which can be serialized by json_encode(), which is a value
554 * of any type other than a resource.
555 */
556 #[\ReturnTypeWillChange]
557 public function jsonSerialize()
558 {
559 return ObjectSerializer::sanitizeForSerialization($this);
560 }
561
562 /**
563 * Gets the string presentation of the object
564 *
565 * @return string
566 */
567 public function __toString()
568 {
569 return json_encode(
570 ObjectSerializer::sanitizeForSerialization($this),
571 JSON_PRETTY_PRINT
572 );
573 }
574
575 /**
576 * Gets a header-safe presentation of the object
577 *
578 * @return string
579 */
580 public function toHeaderValue()
581 {
582 return json_encode(ObjectSerializer::sanitizeForSerialization($this));
583 }
584 }
585
586
587