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

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

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