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