Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
94.74% covered (success)
94.74%
36 / 38
92.59% covered (success)
92.59%
25 / 27
CRAP
0.00% covered (danger)
0.00%
0 / 1
Canvas
94.74% covered (success)
94.74%
36 / 38
92.59% covered (success)
92.59%
25 / 27
32.15
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
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
 getWinding
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setWinding
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getGeometry
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setGeometry
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getText
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setText
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 * Canvas.
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 * Canvas fingerprint containing winding flag plus geometry/text hashes.
36 *
37 * @category Class
38 *
39 * @description Canvas fingerprint containing winding flag plus geometry/text hashes.
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 Canvas 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 = 'Canvas';
59
60    /**
61     * Array of property to type mappings. Used for (de)serialization.
62     *
63     * @var string[]
64     */
65    protected static array $openAPITypes = [
66        'winding' => 'bool',
67        'geometry' => 'string',
68        'text' => 'string',
69    ];
70
71    /**
72     * Array of property to format mappings. Used for (de)serialization.
73     *
74     * @var string[]
75     *
76     * @phpstan-var array<string, string|null>
77     *
78     * @psalm-var array<string, string|null>
79     */
80    protected static array $openAPIFormats = [
81        'winding' => null,
82        'geometry' => null,
83        'text' => null,
84    ];
85
86    /**
87     * Array of nullable properties. Used for (de)serialization.
88     *
89     * @var bool[]
90     */
91    protected static array $openAPINullables = [
92        'winding' => false,
93        'geometry' => false,
94        'text' => false,
95    ];
96
97    /**
98     * If a nullable field gets set to null, insert it here.
99     *
100     * @var bool[]
101     */
102    protected array $openAPINullablesSetToNull = [];
103
104    /**
105     * Array of attributes where the key is the local name,
106     * and the value is the original name.
107     *
108     * @var string[]
109     */
110    protected static array $attributeMap = [
111        'winding' => 'winding',
112        'geometry' => 'geometry',
113        'text' => 'text',
114    ];
115
116    /**
117     * Array of attributes to setter functions (for deserialization of responses).
118     *
119     * @var string[]
120     */
121    protected static array $setters = [
122        'winding' => 'setWinding',
123        'geometry' => 'setGeometry',
124        'text' => 'setText',
125    ];
126
127    /**
128     * Array of attributes to getter functions (for serialization of requests).
129     *
130     * @var string[]
131     */
132    protected static array $getters = [
133        'winding' => 'getWinding',
134        'geometry' => 'getGeometry',
135        'text' => 'getText',
136    ];
137
138    /**
139     * Associative array for storing property values.
140     */
141    protected array $container = [];
142
143    /**
144     * Constructor.
145     *
146     * @param array|null $data Associated array of property values
147     *                         initializing the model
148     *
149     * @noinspection DuplicatedCode
150     */
151    public function __construct(?array $data = null)
152    {
153        $this->setIfExists('winding', $data ?? [], null);
154        $this->setIfExists('geometry', $data ?? [], null);
155        $this->setIfExists('text', $data ?? [], null);
156    }
157
158    /**
159     * Gets the string presentation of the object.
160     *
161     */
162    public function __toString(): string
163    {
164        return json_encode(
165            ObjectSerializer::sanitizeForSerialization($this),
166            JSON_PRETTY_PRINT
167        );
168    }
169
170    /**
171     * Array of property to type mappings. Used for (de)serialization.
172     *
173     */
174    public static function openAPITypes(): array
175    {
176        return self::$openAPITypes;
177    }
178
179    /**
180     * Array of property to format mappings. Used for (de)serialization.
181     */
182    public static function openAPIFormats(): array
183    {
184        return self::$openAPIFormats;
185    }
186
187    /**
188     * Checks if a property is nullable.
189     *
190     */
191    public static function isNullable(string $property): bool
192    {
193        return self::openAPINullables()[$property] ?? false;
194    }
195
196    /**
197     * Checks if a nullable property is set to null.
198     *
199     */
200    public function isNullableSetToNull(string $property): bool
201    {
202        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
203    }
204
205    /**
206     * Array of attributes where the key is the local name,
207     * and the value is the original name.
208     *
209     */
210    public static function attributeMap(): array
211    {
212        return self::$attributeMap;
213    }
214
215    /**
216     * Array of attributes to setter functions (for deserialization of responses).
217     *
218     */
219    public static function setters(): array
220    {
221        return self::$setters;
222    }
223
224    /**
225     * Array of attributes to getter functions (for serialization of requests).
226     *
227     */
228    public static function getters(): array
229    {
230        return self::$getters;
231    }
232
233    /**
234     * The original name of the model.
235     *
236     */
237    public function getModelName(): string
238    {
239        return self::$openAPIModelName;
240    }
241
242    /**
243     * Show all the invalid properties with reasons.
244     *
245     * @return array invalid properties with reasons
246     */
247    public function listInvalidProperties(): array
248    {
249        return [];
250    }
251
252    /**
253     * Validate all the properties in the model
254     * return true if all passed.
255     *
256     * @return bool True if all properties are valid
257     */
258    public function valid(): bool
259    {
260        return 0 === count($this->listInvalidProperties());
261    }
262
263    /**
264     * Gets winding.
265     *
266     */
267    public function getWinding(): ?bool
268    {
269        return $this->container['winding'];
270    }
271
272    /**
273     * Sets winding.
274     *
275     * @param bool $winding winding
276     *
277     */
278    public function setWinding(bool $winding): self
279    {
280        $this->container['winding'] = $winding;
281
282        return $this;
283    }
284
285    /**
286     * Gets geometry.
287     *
288     */
289    public function getGeometry(): ?string
290    {
291        return $this->container['geometry'];
292    }
293
294    /**
295     * Sets geometry.
296     *
297     * @param string $geometry hash of geometry rendering output or `unsupported` markers
298     *
299     */
300    public function setGeometry(string $geometry): self
301    {
302        $this->container['geometry'] = $geometry;
303
304        return $this;
305    }
306
307    /**
308     * Gets text.
309     *
310     */
311    public function getText(): ?string
312    {
313        return $this->container['text'];
314    }
315
316    /**
317     * Sets text.
318     *
319     * @param string $text hash of text rendering output or `unsupported` markers
320     *
321     */
322    public function setText(string $text): self
323    {
324        $this->container['text'] = $text;
325
326        return $this;
327    }
328
329    /**
330     * Returns true if offset exists. False otherwise.
331     *
332     * @param int|string $offset Offset
333     *
334     */
335    public function offsetExists(mixed $offset): bool
336    {
337        return isset($this->container[$offset]);
338    }
339
340    /**
341     * Gets offset.
342     *
343     * @param int|string $offset Offset
344     *
345     * @return mixed|null
346     */
347    #[\ReturnTypeWillChange]
348    public function offsetGet(mixed $offset): mixed
349    {
350        return $this->container[$offset] ?? null;
351    }
352
353    /**
354     * Sets value based on offset.
355     *
356     * @param int|null $offset Offset
357     * @param mixed    $value  Value to be set
358     *
359     */
360    public function offsetSet(mixed $offset, mixed $value): void
361    {
362        if (is_null($offset)) {
363            $this->container[] = $value;
364        } else {
365            $this->container[$offset] = $value;
366        }
367    }
368
369    /**
370     * Unsets offset.
371     *
372     * @param int|string $offset Offset
373     *
374     */
375    public function offsetUnset(mixed $offset): void
376    {
377        unset($this->container[$offset]);
378    }
379
380    /**
381     * Serializes the object to a value that can be serialized natively by json_encode().
382     *
383     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
384     *
385     * @return mixed returns data which can be serialized by json_encode(), which is a value
386     *               of any type other than a resource
387     */
388    #[\ReturnTypeWillChange]
389    public function jsonSerialize(): mixed
390    {
391        return ObjectSerializer::sanitizeForSerialization($this);
392    }
393
394    /**
395     * Gets a header-safe presentation of the object.
396     *
397     */
398    public function toHeaderValue(): string
399    {
400        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
401    }
402
403    /**
404     * Array of nullable properties.
405     */
406    protected static function openAPINullables(): array
407    {
408        return self::$openAPINullables;
409    }
410
411    /**
412     * Array of nullable field names deliberately set to null.
413     *
414     * @return bool[]
415     */
416    private function getOpenAPINullablesSetToNull(): array
417    {
418        return $this->openAPINullablesSetToNull;
419    }
420
421    /**
422     * Setter - Array of nullable field names deliberately set to null.
423     *
424     * @param bool[] $openAPINullablesSetToNull
425     *
426     * @codeCoverageIgnore
427     */
428    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
429    {
430        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
431    }
432
433    /**
434     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
435     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
436     * $this->openAPINullablesSetToNull array.
437     *
438     * @noinspection PhpSameParameterValueInspection
439     */
440    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
441    {
442        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
443            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
444        }
445
446        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
447    }
448}