Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.30% covered (success)
96.30%
52 / 54
94.29% covered (success)
94.29%
33 / 35
CRAP
0.00% covered (danger)
0.00%
0 / 1
FontPreferences
96.30% covered (success)
96.30%
52 / 54
94.29% covered (success)
94.29%
33 / 35
40
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
7 / 7
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
 getDefault
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDefault
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSerif
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSerif
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSans
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSans
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getMono
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setMono
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getApple
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setApple
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getMin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setMin
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSystem
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSystem
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 * FontPreferences.
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 * Baseline measurement of canonical fonts rendered on the device. Numeric width metrics, in CSS pixels, for the canonical fonts collected by the agent.
36 *
37 * @category Class
38 *
39 * @description Baseline measurement of canonical fonts rendered on the device. Numeric width metrics, in CSS pixels, for the canonical fonts collected by the agent.
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 FontPreferences 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 = 'FontPreferences';
59
60    /**
61     * Array of property to type mappings. Used for (de)serialization.
62     *
63     * @var string[]
64     */
65    protected static array $openAPITypes = [
66        'default' => 'float',
67        'serif' => 'float',
68        'sans' => 'float',
69        'mono' => 'float',
70        'apple' => 'float',
71        'min' => 'float',
72        'system' => 'float',
73    ];
74
75    /**
76     * Array of property to format mappings. Used for (de)serialization.
77     *
78     * @var string[]
79     *
80     * @phpstan-var array<string, string|null>
81     *
82     * @psalm-var array<string, string|null>
83     */
84    protected static array $openAPIFormats = [
85        'default' => 'double',
86        'serif' => 'double',
87        'sans' => 'double',
88        'mono' => 'double',
89        'apple' => 'double',
90        'min' => 'double',
91        'system' => 'double',
92    ];
93
94    /**
95     * Array of nullable properties. Used for (de)serialization.
96     *
97     * @var bool[]
98     */
99    protected static array $openAPINullables = [
100        'default' => false,
101        'serif' => false,
102        'sans' => false,
103        'mono' => false,
104        'apple' => false,
105        'min' => false,
106        'system' => false,
107    ];
108
109    /**
110     * If a nullable field gets set to null, insert it here.
111     *
112     * @var bool[]
113     */
114    protected array $openAPINullablesSetToNull = [];
115
116    /**
117     * Array of attributes where the key is the local name,
118     * and the value is the original name.
119     *
120     * @var string[]
121     */
122    protected static array $attributeMap = [
123        'default' => 'default',
124        'serif' => 'serif',
125        'sans' => 'sans',
126        'mono' => 'mono',
127        'apple' => 'apple',
128        'min' => 'min',
129        'system' => 'system',
130    ];
131
132    /**
133     * Array of attributes to setter functions (for deserialization of responses).
134     *
135     * @var string[]
136     */
137    protected static array $setters = [
138        'default' => 'setDefault',
139        'serif' => 'setSerif',
140        'sans' => 'setSans',
141        'mono' => 'setMono',
142        'apple' => 'setApple',
143        'min' => 'setMin',
144        'system' => 'setSystem',
145    ];
146
147    /**
148     * Array of attributes to getter functions (for serialization of requests).
149     *
150     * @var string[]
151     */
152    protected static array $getters = [
153        'default' => 'getDefault',
154        'serif' => 'getSerif',
155        'sans' => 'getSans',
156        'mono' => 'getMono',
157        'apple' => 'getApple',
158        'min' => 'getMin',
159        'system' => 'getSystem',
160    ];
161
162    /**
163     * Associative array for storing property values.
164     */
165    protected array $container = [];
166
167    /**
168     * Constructor.
169     *
170     * @param array|null $data Associated array of property values
171     *                         initializing the model
172     *
173     * @noinspection DuplicatedCode
174     */
175    public function __construct(?array $data = null)
176    {
177        $this->setIfExists('default', $data ?? [], null);
178        $this->setIfExists('serif', $data ?? [], null);
179        $this->setIfExists('sans', $data ?? [], null);
180        $this->setIfExists('mono', $data ?? [], null);
181        $this->setIfExists('apple', $data ?? [], null);
182        $this->setIfExists('min', $data ?? [], null);
183        $this->setIfExists('system', $data ?? [], null);
184    }
185
186    /**
187     * Gets the string presentation of the object.
188     *
189     */
190    public function __toString(): string
191    {
192        return json_encode(
193            ObjectSerializer::sanitizeForSerialization($this),
194            JSON_PRETTY_PRINT
195        );
196    }
197
198    /**
199     * Array of property to type mappings. Used for (de)serialization.
200     *
201     */
202    public static function openAPITypes(): array
203    {
204        return self::$openAPITypes;
205    }
206
207    /**
208     * Array of property to format mappings. Used for (de)serialization.
209     */
210    public static function openAPIFormats(): array
211    {
212        return self::$openAPIFormats;
213    }
214
215    /**
216     * Checks if a property is nullable.
217     *
218     */
219    public static function isNullable(string $property): bool
220    {
221        return self::openAPINullables()[$property] ?? false;
222    }
223
224    /**
225     * Checks if a nullable property is set to null.
226     *
227     */
228    public function isNullableSetToNull(string $property): bool
229    {
230        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
231    }
232
233    /**
234     * Array of attributes where the key is the local name,
235     * and the value is the original name.
236     *
237     */
238    public static function attributeMap(): array
239    {
240        return self::$attributeMap;
241    }
242
243    /**
244     * Array of attributes to setter functions (for deserialization of responses).
245     *
246     */
247    public static function setters(): array
248    {
249        return self::$setters;
250    }
251
252    /**
253     * Array of attributes to getter functions (for serialization of requests).
254     *
255     */
256    public static function getters(): array
257    {
258        return self::$getters;
259    }
260
261    /**
262     * The original name of the model.
263     *
264     */
265    public function getModelName(): string
266    {
267        return self::$openAPIModelName;
268    }
269
270    /**
271     * Show all the invalid properties with reasons.
272     *
273     * @return array invalid properties with reasons
274     */
275    public function listInvalidProperties(): array
276    {
277        return [];
278    }
279
280    /**
281     * Validate all the properties in the model
282     * return true if all passed.
283     *
284     * @return bool True if all properties are valid
285     */
286    public function valid(): bool
287    {
288        return 0 === count($this->listInvalidProperties());
289    }
290
291    /**
292     * Gets default.
293     *
294     */
295    public function getDefault(): ?float
296    {
297        return $this->container['default'];
298    }
299
300    /**
301     * Sets default.
302     *
303     * @param float $default default
304     *
305     */
306    public function setDefault(float $default): self
307    {
308        $this->container['default'] = $default;
309
310        return $this;
311    }
312
313    /**
314     * Gets serif.
315     *
316     */
317    public function getSerif(): ?float
318    {
319        return $this->container['serif'];
320    }
321
322    /**
323     * Sets serif.
324     *
325     * @param float $serif serif
326     *
327     */
328    public function setSerif(float $serif): self
329    {
330        $this->container['serif'] = $serif;
331
332        return $this;
333    }
334
335    /**
336     * Gets sans.
337     *
338     */
339    public function getSans(): ?float
340    {
341        return $this->container['sans'];
342    }
343
344    /**
345     * Sets sans.
346     *
347     * @param float $sans sans
348     *
349     */
350    public function setSans(float $sans): self
351    {
352        $this->container['sans'] = $sans;
353
354        return $this;
355    }
356
357    /**
358     * Gets mono.
359     *
360     */
361    public function getMono(): ?float
362    {
363        return $this->container['mono'];
364    }
365
366    /**
367     * Sets mono.
368     *
369     * @param float $mono mono
370     *
371     */
372    public function setMono(float $mono): self
373    {
374        $this->container['mono'] = $mono;
375
376        return $this;
377    }
378
379    /**
380     * Gets apple.
381     *
382     */
383    public function getApple(): ?float
384    {
385        return $this->container['apple'];
386    }
387
388    /**
389     * Sets apple.
390     *
391     * @param float $apple apple
392     *
393     */
394    public function setApple(float $apple): self
395    {
396        $this->container['apple'] = $apple;
397
398        return $this;
399    }
400
401    /**
402     * Gets min.
403     *
404     */
405    public function getMin(): ?float
406    {
407        return $this->container['min'];
408    }
409
410    /**
411     * Sets min.
412     *
413     * @param float $min min
414     *
415     */
416    public function setMin(float $min): self
417    {
418        $this->container['min'] = $min;
419
420        return $this;
421    }
422
423    /**
424     * Gets system.
425     *
426     */
427    public function getSystem(): ?float
428    {
429        return $this->container['system'];
430    }
431
432    /**
433     * Sets system.
434     *
435     * @param float $system system
436     *
437     */
438    public function setSystem(float $system): self
439    {
440        $this->container['system'] = $system;
441
442        return $this;
443    }
444
445    /**
446     * Returns true if offset exists. False otherwise.
447     *
448     * @param int|string $offset Offset
449     *
450     */
451    public function offsetExists(mixed $offset): bool
452    {
453        return isset($this->container[$offset]);
454    }
455
456    /**
457     * Gets offset.
458     *
459     * @param int|string $offset Offset
460     *
461     * @return mixed|null
462     */
463    #[\ReturnTypeWillChange]
464    public function offsetGet(mixed $offset): mixed
465    {
466        return $this->container[$offset] ?? null;
467    }
468
469    /**
470     * Sets value based on offset.
471     *
472     * @param int|null $offset Offset
473     * @param mixed    $value  Value to be set
474     *
475     */
476    public function offsetSet(mixed $offset, mixed $value): void
477    {
478        if (is_null($offset)) {
479            $this->container[] = $value;
480        } else {
481            $this->container[$offset] = $value;
482        }
483    }
484
485    /**
486     * Unsets offset.
487     *
488     * @param int|string $offset Offset
489     *
490     */
491    public function offsetUnset(mixed $offset): void
492    {
493        unset($this->container[$offset]);
494    }
495
496    /**
497     * Serializes the object to a value that can be serialized natively by json_encode().
498     *
499     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
500     *
501     * @return mixed returns data which can be serialized by json_encode(), which is a value
502     *               of any type other than a resource
503     */
504    #[\ReturnTypeWillChange]
505    public function jsonSerialize(): mixed
506    {
507        return ObjectSerializer::sanitizeForSerialization($this);
508    }
509
510    /**
511     * Gets a header-safe presentation of the object.
512     *
513     */
514    public function toHeaderValue(): string
515    {
516        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
517    }
518
519    /**
520     * Array of nullable properties.
521     */
522    protected static function openAPINullables(): array
523    {
524        return self::$openAPINullables;
525    }
526
527    /**
528     * Array of nullable field names deliberately set to null.
529     *
530     * @return bool[]
531     */
532    private function getOpenAPINullablesSetToNull(): array
533    {
534        return $this->openAPINullablesSetToNull;
535    }
536
537    /**
538     * Setter - Array of nullable field names deliberately set to null.
539     *
540     * @param bool[] $openAPINullablesSetToNull
541     *
542     * @codeCoverageIgnore
543     */
544    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
545    {
546        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
547    }
548
549    /**
550     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
551     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
552     * $this->openAPINullablesSetToNull array.
553     *
554     * @noinspection PhpSameParameterValueInspection
555     */
556    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
557    {
558        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
559            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
560        }
561
562        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
563    }
564}