Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.00% covered (success)
96.00%
48 / 50
93.94% covered (success)
93.94%
31 / 33
CRAP
0.00% covered (danger)
0.00%
0 / 1
WebGlExtensions
96.00% covered (success)
96.00%
48 / 50
93.94% covered (success)
93.94%
31 / 33
38
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 __toString
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 openAPITypes
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 openAPIFormats
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isNullable
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isNullableSetToNull
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 attributeMap
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getModelName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 listInvalidProperties
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 valid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getContextAttributes
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setContextAttributes
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getParameters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setParameters
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getShaderPrecisions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setShaderPrecisions
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getExtensions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setExtensions
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getExtensionParameters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setExtensionParameters
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getUnsupportedExtensions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setUnsupportedExtensions
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 offsetExists
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 offsetGet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 offsetSet
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 offsetUnset
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toHeaderValue
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 openAPINullables
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOpenAPINullablesSetToNull
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setOpenAPINullablesSetToNull
n/a
0 / 0
n/a
0 / 0
1
 setIfExists
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3/**
4 * WebGlExtensions.
5 *
6 * @category Class
7 *
8 * @author   Fingerprint
9 *
10 * @see      https://fingerprint.com
11 */
12
13/**
14 * Server API.
15 *
16 * Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
17 *
18 * The version of the OpenAPI document: 4
19 * Contact: support@fingerprint.com
20 * Generated by: https://openapi-generator.tech
21 * Generator version: 7.21.0
22 */
23
24/**
25 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
26 * https://openapi-generator.tech
27 * Do not edit the class manually.
28 */
29
30namespace Fingerprint\ServerSdk\Model;
31
32use Fingerprint\ServerSdk\ObjectSerializer;
33
34/**
35 * Hashes of WebGL context attributes and extension support.
36 *
37 * @category Class
38 *
39 * @description Hashes of WebGL context attributes and extension support.
40 *
41 * @author   Fingerprint
42 *
43 * @see      https://fingerprint.com
44 *
45 * @implements \ArrayAccess<string, mixed>
46 *
47 * @noinspection GrazieInspection
48 * @noinspection RedundantSuppression
49 */
50class WebGlExtensions implements ModelInterface, \ArrayAccess, \JsonSerializable
51{
52    public const DISCRIMINATOR = null;
53
54    /**
55     * The original name of the model.
56     *
57     */
58    protected static string $openAPIModelName = 'WebGlExtensions';
59
60    /**
61     * Array of property to type mappings. Used for (de)serialization.
62     *
63     * @var string[]
64     */
65    protected static array $openAPITypes = [
66        'context_attributes' => 'string',
67        'parameters' => 'string',
68        'shader_precisions' => 'string',
69        'extensions' => 'string',
70        'extension_parameters' => 'string',
71        'unsupported_extensions' => 'string[]',
72    ];
73
74    /**
75     * Array of property to format mappings. Used for (de)serialization.
76     *
77     * @var string[]
78     *
79     * @phpstan-var array<string, string|null>
80     *
81     * @psalm-var array<string, string|null>
82     */
83    protected static array $openAPIFormats = [
84        'context_attributes' => null,
85        'parameters' => null,
86        'shader_precisions' => null,
87        'extensions' => null,
88        'extension_parameters' => null,
89        'unsupported_extensions' => null,
90    ];
91
92    /**
93     * Array of nullable properties. Used for (de)serialization.
94     *
95     * @var bool[]
96     */
97    protected static array $openAPINullables = [
98        'context_attributes' => false,
99        'parameters' => false,
100        'shader_precisions' => false,
101        'extensions' => false,
102        'extension_parameters' => false,
103        'unsupported_extensions' => false,
104    ];
105
106    /**
107     * If a nullable field gets set to null, insert it here.
108     *
109     * @var bool[]
110     */
111    protected array $openAPINullablesSetToNull = [];
112
113    /**
114     * Array of attributes where the key is the local name,
115     * and the value is the original name.
116     *
117     * @var string[]
118     */
119    protected static array $attributeMap = [
120        'context_attributes' => 'context_attributes',
121        'parameters' => 'parameters',
122        'shader_precisions' => 'shader_precisions',
123        'extensions' => 'extensions',
124        'extension_parameters' => 'extension_parameters',
125        'unsupported_extensions' => 'unsupported_extensions',
126    ];
127
128    /**
129     * Array of attributes to setter functions (for deserialization of responses).
130     *
131     * @var string[]
132     */
133    protected static array $setters = [
134        'context_attributes' => 'setContextAttributes',
135        'parameters' => 'setParameters',
136        'shader_precisions' => 'setShaderPrecisions',
137        'extensions' => 'setExtensions',
138        'extension_parameters' => 'setExtensionParameters',
139        'unsupported_extensions' => 'setUnsupportedExtensions',
140    ];
141
142    /**
143     * Array of attributes to getter functions (for serialization of requests).
144     *
145     * @var string[]
146     */
147    protected static array $getters = [
148        'context_attributes' => 'getContextAttributes',
149        'parameters' => 'getParameters',
150        'shader_precisions' => 'getShaderPrecisions',
151        'extensions' => 'getExtensions',
152        'extension_parameters' => 'getExtensionParameters',
153        'unsupported_extensions' => 'getUnsupportedExtensions',
154    ];
155
156    /**
157     * Associative array for storing property values.
158     */
159    protected array $container = [];
160
161    /**
162     * Constructor.
163     *
164     * @param array|null $data Associated array of property values
165     *                         initializing the model
166     *
167     * @noinspection DuplicatedCode
168     */
169    public function __construct(?array $data = null)
170    {
171        $this->setIfExists('context_attributes', $data ?? [], null);
172        $this->setIfExists('parameters', $data ?? [], null);
173        $this->setIfExists('shader_precisions', $data ?? [], null);
174        $this->setIfExists('extensions', $data ?? [], null);
175        $this->setIfExists('extension_parameters', $data ?? [], null);
176        $this->setIfExists('unsupported_extensions', $data ?? [], null);
177    }
178
179    /**
180     * Gets the string presentation of the object.
181     *
182     */
183    public function __toString(): string
184    {
185        return json_encode(
186            ObjectSerializer::sanitizeForSerialization($this),
187            JSON_PRETTY_PRINT
188        );
189    }
190
191    /**
192     * Array of property to type mappings. Used for (de)serialization.
193     *
194     */
195    public static function openAPITypes(): array
196    {
197        return self::$openAPITypes;
198    }
199
200    /**
201     * Array of property to format mappings. Used for (de)serialization.
202     */
203    public static function openAPIFormats(): array
204    {
205        return self::$openAPIFormats;
206    }
207
208    /**
209     * Checks if a property is nullable.
210     *
211     */
212    public static function isNullable(string $property): bool
213    {
214        return self::openAPINullables()[$property] ?? false;
215    }
216
217    /**
218     * Checks if a nullable property is set to null.
219     *
220     */
221    public function isNullableSetToNull(string $property): bool
222    {
223        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
224    }
225
226    /**
227     * Array of attributes where the key is the local name,
228     * and the value is the original name.
229     *
230     */
231    public static function attributeMap(): array
232    {
233        return self::$attributeMap;
234    }
235
236    /**
237     * Array of attributes to setter functions (for deserialization of responses).
238     *
239     */
240    public static function setters(): array
241    {
242        return self::$setters;
243    }
244
245    /**
246     * Array of attributes to getter functions (for serialization of requests).
247     *
248     */
249    public static function getters(): array
250    {
251        return self::$getters;
252    }
253
254    /**
255     * The original name of the model.
256     *
257     */
258    public function getModelName(): string
259    {
260        return self::$openAPIModelName;
261    }
262
263    /**
264     * Show all the invalid properties with reasons.
265     *
266     * @return array invalid properties with reasons
267     */
268    public function listInvalidProperties(): array
269    {
270        return [];
271    }
272
273    /**
274     * Validate all the properties in the model
275     * return true if all passed.
276     *
277     * @return bool True if all properties are valid
278     */
279    public function valid(): bool
280    {
281        return 0 === count($this->listInvalidProperties());
282    }
283
284    /**
285     * Gets context_attributes.
286     *
287     */
288    public function getContextAttributes(): ?string
289    {
290        return $this->container['context_attributes'];
291    }
292
293    /**
294     * Sets context_attributes.
295     *
296     * @param string $context_attributes context_attributes
297     *
298     */
299    public function setContextAttributes(string $context_attributes): self
300    {
301        $this->container['context_attributes'] = $context_attributes;
302
303        return $this;
304    }
305
306    /**
307     * Gets parameters.
308     *
309     */
310    public function getParameters(): ?string
311    {
312        return $this->container['parameters'];
313    }
314
315    /**
316     * Sets parameters.
317     *
318     * @param string $parameters parameters
319     *
320     */
321    public function setParameters(string $parameters): self
322    {
323        $this->container['parameters'] = $parameters;
324
325        return $this;
326    }
327
328    /**
329     * Gets shader_precisions.
330     *
331     */
332    public function getShaderPrecisions(): ?string
333    {
334        return $this->container['shader_precisions'];
335    }
336
337    /**
338     * Sets shader_precisions.
339     *
340     * @param string $shader_precisions shader_precisions
341     *
342     */
343    public function setShaderPrecisions(string $shader_precisions): self
344    {
345        $this->container['shader_precisions'] = $shader_precisions;
346
347        return $this;
348    }
349
350    /**
351     * Gets extensions.
352     *
353     */
354    public function getExtensions(): ?string
355    {
356        return $this->container['extensions'];
357    }
358
359    /**
360     * Sets extensions.
361     *
362     * @param string $extensions extensions
363     *
364     */
365    public function setExtensions(string $extensions): self
366    {
367        $this->container['extensions'] = $extensions;
368
369        return $this;
370    }
371
372    /**
373     * Gets extension_parameters.
374     *
375     */
376    public function getExtensionParameters(): ?string
377    {
378        return $this->container['extension_parameters'];
379    }
380
381    /**
382     * Sets extension_parameters.
383     *
384     * @param string $extension_parameters extension_parameters
385     *
386     */
387    public function setExtensionParameters(string $extension_parameters): self
388    {
389        $this->container['extension_parameters'] = $extension_parameters;
390
391        return $this;
392    }
393
394    /**
395     * Gets unsupported_extensions.
396     *
397     * @return string[]|null
398     */
399    public function getUnsupportedExtensions(): ?array
400    {
401        return $this->container['unsupported_extensions'];
402    }
403
404    /**
405     * Sets unsupported_extensions.
406     *
407     * @param string[] $unsupported_extensions unsupported_extensions
408     *
409     */
410    public function setUnsupportedExtensions(array $unsupported_extensions): self
411    {
412        $this->container['unsupported_extensions'] = $unsupported_extensions;
413
414        return $this;
415    }
416
417    /**
418     * Returns true if offset exists. False otherwise.
419     *
420     * @param int|string $offset Offset
421     *
422     */
423    public function offsetExists(mixed $offset): bool
424    {
425        return isset($this->container[$offset]);
426    }
427
428    /**
429     * Gets offset.
430     *
431     * @param int|string $offset Offset
432     *
433     * @return mixed|null
434     */
435    #[\ReturnTypeWillChange]
436    public function offsetGet(mixed $offset): mixed
437    {
438        return $this->container[$offset] ?? null;
439    }
440
441    /**
442     * Sets value based on offset.
443     *
444     * @param int|null $offset Offset
445     * @param mixed    $value  Value to be set
446     *
447     */
448    public function offsetSet(mixed $offset, mixed $value): void
449    {
450        if (is_null($offset)) {
451            $this->container[] = $value;
452        } else {
453            $this->container[$offset] = $value;
454        }
455    }
456
457    /**
458     * Unsets offset.
459     *
460     * @param int|string $offset Offset
461     *
462     */
463    public function offsetUnset(mixed $offset): void
464    {
465        unset($this->container[$offset]);
466    }
467
468    /**
469     * Serializes the object to a value that can be serialized natively by json_encode().
470     *
471     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
472     *
473     * @return mixed returns data which can be serialized by json_encode(), which is a value
474     *               of any type other than a resource
475     */
476    #[\ReturnTypeWillChange]
477    public function jsonSerialize(): mixed
478    {
479        return ObjectSerializer::sanitizeForSerialization($this);
480    }
481
482    /**
483     * Gets a header-safe presentation of the object.
484     *
485     */
486    public function toHeaderValue(): string
487    {
488        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
489    }
490
491    /**
492     * Array of nullable properties.
493     */
494    protected static function openAPINullables(): array
495    {
496        return self::$openAPINullables;
497    }
498
499    /**
500     * Array of nullable field names deliberately set to null.
501     *
502     * @return bool[]
503     */
504    private function getOpenAPINullablesSetToNull(): array
505    {
506        return $this->openAPINullablesSetToNull;
507    }
508
509    /**
510     * Setter - Array of nullable field names deliberately set to null.
511     *
512     * @param bool[] $openAPINullablesSetToNull
513     *
514     * @codeCoverageIgnore
515     */
516    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
517    {
518        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
519    }
520
521    /**
522     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
523     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
524     * $this->openAPINullablesSetToNull array.
525     *
526     * @noinspection PhpSameParameterValueInspection
527     */
528    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
529    {
530        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
531            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
532        }
533
534        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
535    }
536}