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