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