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