Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
41 / 41
100.00% covered (success)
100.00%
27 / 27
CRAP
100.00% covered (success)
100.00%
1 / 1
EventSearch
100.00% covered (success)
100.00%
41 / 41
100.00% covered (success)
100.00%
27 / 27
33
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%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 valid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEvents
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEvents
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPaginationKey
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPaginationKey
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTotalHits
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTotalHits
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 * EventSearch.
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 * Contains a list of all identification events matching the specified search criteria.
36 *
37 * @category Class
38 *
39 * @description Contains a list of all identification events matching the specified search criteria.
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 EventSearch 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 = 'EventSearch';
59
60    /**
61     * Array of property to type mappings. Used for (de)serialization.
62     *
63     * @var string[]
64     */
65    protected static array $openAPITypes = [
66        'events' => '\Fingerprint\ServerSdk\Model\Event[]',
67        'pagination_key' => 'string',
68        'total_hits' => 'int',
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        'events' => null,
82        'pagination_key' => null,
83        'total_hits' => 'int64',
84    ];
85
86    /**
87     * Array of nullable properties. Used for (de)serialization.
88     *
89     * @var bool[]
90     */
91    protected static array $openAPINullables = [
92        'events' => false,
93        'pagination_key' => false,
94        'total_hits' => 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        'events' => 'events',
112        'pagination_key' => 'pagination_key',
113        'total_hits' => 'total_hits',
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        'events' => 'setEvents',
123        'pagination_key' => 'setPaginationKey',
124        'total_hits' => 'setTotalHits',
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        'events' => 'getEvents',
134        'pagination_key' => 'getPaginationKey',
135        'total_hits' => 'getTotalHits',
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('events', $data ?? [], null);
154        $this->setIfExists('pagination_key', $data ?? [], null);
155        $this->setIfExists('total_hits', $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        $invalidProperties = [];
250
251        if (null === $this->container['events']) {
252            $invalidProperties[] = "'events' can't be null";
253        }
254
255        return $invalidProperties;
256    }
257
258    /**
259     * Validate all the properties in the model
260     * return true if all passed.
261     *
262     * @return bool True if all properties are valid
263     */
264    public function valid(): bool
265    {
266        return 0 === count($this->listInvalidProperties());
267    }
268
269    /**
270     * Gets events.
271     *
272     * @return Event[]|null
273     */
274    public function getEvents(): ?array
275    {
276        return $this->container['events'];
277    }
278
279    /**
280     * Sets events.
281     *
282     * @param Event[] $events events
283     *
284     */
285    public function setEvents(array $events): self
286    {
287        $this->container['events'] = $events;
288
289        return $this;
290    }
291
292    /**
293     * Gets pagination_key.
294     *
295     */
296    public function getPaginationKey(): ?string
297    {
298        return $this->container['pagination_key'];
299    }
300
301    /**
302     * Sets pagination_key.
303     *
304     * @param string $pagination_key use this value in the `pagination_key` parameter to request the next page of search results
305     *
306     */
307    public function setPaginationKey(string $pagination_key): self
308    {
309        $this->container['pagination_key'] = $pagination_key;
310
311        return $this;
312    }
313
314    /**
315     * Gets total_hits.
316     *
317     */
318    public function getTotalHits(): ?int
319    {
320        return $this->container['total_hits'];
321    }
322
323    /**
324     * Sets total_hits.
325     *
326     * @param int $total_hits This value represents the total number of events matching the search query, up to the limit provided in the `total_hits` query parameter. Only present if the `total_hits` query parameter was provided.
327     *
328     */
329    public function setTotalHits(int $total_hits): self
330    {
331        $this->container['total_hits'] = $total_hits;
332
333        return $this;
334    }
335
336    /**
337     * Returns true if offset exists. False otherwise.
338     *
339     * @param int|string $offset Offset
340     *
341     */
342    public function offsetExists(mixed $offset): bool
343    {
344        return isset($this->container[$offset]);
345    }
346
347    /**
348     * Gets offset.
349     *
350     * @param int|string $offset Offset
351     *
352     * @return mixed|null
353     */
354    #[\ReturnTypeWillChange]
355    public function offsetGet(mixed $offset): mixed
356    {
357        return $this->container[$offset] ?? null;
358    }
359
360    /**
361     * Sets value based on offset.
362     *
363     * @param int|null $offset Offset
364     * @param mixed    $value  Value to be set
365     *
366     */
367    public function offsetSet(mixed $offset, mixed $value): void
368    {
369        if (is_null($offset)) {
370            $this->container[] = $value;
371        } else {
372            $this->container[$offset] = $value;
373        }
374    }
375
376    /**
377     * Unsets offset.
378     *
379     * @param int|string $offset Offset
380     *
381     */
382    public function offsetUnset(mixed $offset): void
383    {
384        unset($this->container[$offset]);
385    }
386
387    /**
388     * Serializes the object to a value that can be serialized natively by json_encode().
389     *
390     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
391     *
392     * @return mixed returns data which can be serialized by json_encode(), which is a value
393     *               of any type other than a resource
394     */
395    #[\ReturnTypeWillChange]
396    public function jsonSerialize(): mixed
397    {
398        return ObjectSerializer::sanitizeForSerialization($this);
399    }
400
401    /**
402     * Gets a header-safe presentation of the object.
403     *
404     */
405    public function toHeaderValue(): string
406    {
407        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
408    }
409
410    /**
411     * Array of nullable properties.
412     */
413    protected static function openAPINullables(): array
414    {
415        return self::$openAPINullables;
416    }
417
418    /**
419     * Array of nullable field names deliberately set to null.
420     *
421     * @return bool[]
422     */
423    private function getOpenAPINullablesSetToNull(): array
424    {
425        return $this->openAPINullablesSetToNull;
426    }
427
428    /**
429     * Setter - Array of nullable field names deliberately set to null.
430     *
431     * @param bool[] $openAPINullablesSetToNull
432     *
433     * @codeCoverageIgnore
434     */
435    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
436    {
437        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
438    }
439
440    /**
441     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
442     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
443     * $this->openAPINullablesSetToNull array.
444     *
445     * @noinspection PhpSameParameterValueInspection
446     */
447    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
448    {
449        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
450            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
451        }
452
453        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
454    }
455}