Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.16% covered (success)
92.16%
47 / 51
90.32% covered (success)
90.32%
28 / 31
CRAP
0.00% covered (danger)
0.00%
0 / 1
SupplementaryIDHighRecall
92.16% covered (success)
92.16%
47 / 51
90.32% covered (success)
90.32%
28 / 31
38.70
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
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
 getVisitorId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setVisitorId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getVisitorFound
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setVisitorFound
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getConfidence
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setConfidence
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getFirstSeenAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFirstSeenAt
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLastSeenAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLastSeenAt
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 * SupplementaryIDHighRecall.
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 * The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.
36 *
37 * @category Class
38 *
39 * @description The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.
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 SupplementaryIDHighRecall 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 = 'SupplementaryIDHighRecall';
59
60    /**
61     * Array of property to type mappings. Used for (de)serialization.
62     *
63     * @var string[]
64     */
65    protected static array $openAPITypes = [
66        'visitor_id' => 'string',
67        'visitor_found' => 'bool',
68        'confidence' => '\Fingerprint\ServerSdk\Model\IdentificationConfidence',
69        'first_seen_at' => 'int',
70        'last_seen_at' => 'int',
71    ];
72
73    /**
74     * Array of property to format mappings. Used for (de)serialization.
75     *
76     * @var string[]
77     *
78     * @phpstan-var array<string, string|null>
79     *
80     * @psalm-var array<string, string|null>
81     */
82    protected static array $openAPIFormats = [
83        'visitor_id' => null,
84        'visitor_found' => null,
85        'confidence' => null,
86        'first_seen_at' => 'int64',
87        'last_seen_at' => 'int64',
88    ];
89
90    /**
91     * Array of nullable properties. Used for (de)serialization.
92     *
93     * @var bool[]
94     */
95    protected static array $openAPINullables = [
96        'visitor_id' => false,
97        'visitor_found' => false,
98        'confidence' => false,
99        'first_seen_at' => false,
100        'last_seen_at' => false,
101    ];
102
103    /**
104     * If a nullable field gets set to null, insert it here.
105     *
106     * @var bool[]
107     */
108    protected array $openAPINullablesSetToNull = [];
109
110    /**
111     * Array of attributes where the key is the local name,
112     * and the value is the original name.
113     *
114     * @var string[]
115     */
116    protected static array $attributeMap = [
117        'visitor_id' => 'visitor_id',
118        'visitor_found' => 'visitor_found',
119        'confidence' => 'confidence',
120        'first_seen_at' => 'first_seen_at',
121        'last_seen_at' => 'last_seen_at',
122    ];
123
124    /**
125     * Array of attributes to setter functions (for deserialization of responses).
126     *
127     * @var string[]
128     */
129    protected static array $setters = [
130        'visitor_id' => 'setVisitorId',
131        'visitor_found' => 'setVisitorFound',
132        'confidence' => 'setConfidence',
133        'first_seen_at' => 'setFirstSeenAt',
134        'last_seen_at' => 'setLastSeenAt',
135    ];
136
137    /**
138     * Array of attributes to getter functions (for serialization of requests).
139     *
140     * @var string[]
141     */
142    protected static array $getters = [
143        'visitor_id' => 'getVisitorId',
144        'visitor_found' => 'getVisitorFound',
145        'confidence' => 'getConfidence',
146        'first_seen_at' => 'getFirstSeenAt',
147        'last_seen_at' => 'getLastSeenAt',
148    ];
149
150    /**
151     * Associative array for storing property values.
152     */
153    protected array $container = [];
154
155    /**
156     * Constructor.
157     *
158     * @param array|null $data Associated array of property values
159     *                         initializing the model
160     *
161     * @noinspection DuplicatedCode
162     */
163    public function __construct(?array $data = null)
164    {
165        $this->setIfExists('visitor_id', $data ?? [], null);
166        $this->setIfExists('visitor_found', $data ?? [], null);
167        $this->setIfExists('confidence', $data ?? [], null);
168        $this->setIfExists('first_seen_at', $data ?? [], null);
169        $this->setIfExists('last_seen_at', $data ?? [], null);
170    }
171
172    /**
173     * Gets the string presentation of the object.
174     *
175     */
176    public function __toString(): string
177    {
178        return json_encode(
179            ObjectSerializer::sanitizeForSerialization($this),
180            JSON_PRETTY_PRINT
181        );
182    }
183
184    /**
185     * Array of property to type mappings. Used for (de)serialization.
186     *
187     */
188    public static function openAPITypes(): array
189    {
190        return self::$openAPITypes;
191    }
192
193    /**
194     * Array of property to format mappings. Used for (de)serialization.
195     */
196    public static function openAPIFormats(): array
197    {
198        return self::$openAPIFormats;
199    }
200
201    /**
202     * Checks if a property is nullable.
203     *
204     */
205    public static function isNullable(string $property): bool
206    {
207        return self::openAPINullables()[$property] ?? false;
208    }
209
210    /**
211     * Checks if a nullable property is set to null.
212     *
213     */
214    public function isNullableSetToNull(string $property): bool
215    {
216        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
217    }
218
219    /**
220     * Array of attributes where the key is the local name,
221     * and the value is the original name.
222     *
223     */
224    public static function attributeMap(): array
225    {
226        return self::$attributeMap;
227    }
228
229    /**
230     * Array of attributes to setter functions (for deserialization of responses).
231     *
232     */
233    public static function setters(): array
234    {
235        return self::$setters;
236    }
237
238    /**
239     * Array of attributes to getter functions (for serialization of requests).
240     *
241     */
242    public static function getters(): array
243    {
244        return self::$getters;
245    }
246
247    /**
248     * The original name of the model.
249     *
250     */
251    public function getModelName(): string
252    {
253        return self::$openAPIModelName;
254    }
255
256    /**
257     * Show all the invalid properties with reasons.
258     *
259     * @return array invalid properties with reasons
260     */
261    public function listInvalidProperties(): array
262    {
263        $invalidProperties = [];
264
265        if (null === $this->container['visitor_id']) {
266            $invalidProperties[] = "'visitor_id' can't be null";
267        }
268        if (null === $this->container['visitor_found']) {
269            $invalidProperties[] = "'visitor_found' can't be null";
270        }
271
272        return $invalidProperties;
273    }
274
275    /**
276     * Validate all the properties in the model
277     * return true if all passed.
278     *
279     * @return bool True if all properties are valid
280     */
281    public function valid(): bool
282    {
283        return 0 === count($this->listInvalidProperties());
284    }
285
286    /**
287     * Gets visitor_id.
288     *
289     */
290    public function getVisitorId(): ?string
291    {
292        return $this->container['visitor_id'];
293    }
294
295    /**
296     * Sets visitor_id.
297     *
298     * @param string $visitor_id The High Recall identifier for the visitor's browser. It is an alphanumeric string with a maximum length of 25 characters.
299     *
300     */
301    public function setVisitorId(string $visitor_id): self
302    {
303        $this->container['visitor_id'] = $visitor_id;
304
305        return $this;
306    }
307
308    /**
309     * Gets visitor_found.
310     *
311     */
312    public function getVisitorFound(): ?bool
313    {
314        return $this->container['visitor_found'];
315    }
316
317    /**
318     * Sets visitor_found.
319     *
320     * @param bool $visitor_found True if this is a returning browser and has been previously identified. Otherwise, false.
321     *
322     */
323    public function setVisitorFound(bool $visitor_found): self
324    {
325        $this->container['visitor_found'] = $visitor_found;
326
327        return $this;
328    }
329
330    /**
331     * Gets confidence.
332     *
333     */
334    public function getConfidence(): ?IdentificationConfidence
335    {
336        return $this->container['confidence'];
337    }
338
339    /**
340     * Sets confidence.
341     *
342     * @param IdentificationConfidence $confidence confidence
343     *
344     */
345    public function setConfidence(IdentificationConfidence $confidence): self
346    {
347        $this->container['confidence'] = $confidence;
348
349        return $this;
350    }
351
352    /**
353     * Gets first_seen_at.
354     *
355     */
356    public function getFirstSeenAt(): ?int
357    {
358        return $this->container['first_seen_at'];
359    }
360
361    /**
362     * Sets first_seen_at.
363     *
364     * @param int $first_seen_at Unix epoch timestamp (in milliseconds) indicating when the browser was first identified. example: `1758069706642` - Corresponding to Wed Sep 17 2025 00:41:46 GMT+0000
365     *
366     */
367    public function setFirstSeenAt(int $first_seen_at): self
368    {
369        $this->container['first_seen_at'] = $first_seen_at;
370
371        return $this;
372    }
373
374    /**
375     * Gets last_seen_at.
376     *
377     */
378    public function getLastSeenAt(): ?int
379    {
380        return $this->container['last_seen_at'];
381    }
382
383    /**
384     * Sets last_seen_at.
385     *
386     * @param int $last_seen_at Unix epoch timestamp (in milliseconds) corresponding to the most recent visit by this browser. example: `1758069706642` - Corresponding to Wed Sep 17 2025 00:41:46 GMT+0000
387     *
388     */
389    public function setLastSeenAt(int $last_seen_at): self
390    {
391        $this->container['last_seen_at'] = $last_seen_at;
392
393        return $this;
394    }
395
396    /**
397     * Returns true if offset exists. False otherwise.
398     *
399     * @param int|string $offset Offset
400     *
401     */
402    public function offsetExists(mixed $offset): bool
403    {
404        return isset($this->container[$offset]);
405    }
406
407    /**
408     * Gets offset.
409     *
410     * @param int|string $offset Offset
411     *
412     * @return mixed|null
413     */
414    #[\ReturnTypeWillChange]
415    public function offsetGet(mixed $offset): mixed
416    {
417        return $this->container[$offset] ?? null;
418    }
419
420    /**
421     * Sets value based on offset.
422     *
423     * @param int|null $offset Offset
424     * @param mixed    $value  Value to be set
425     *
426     */
427    public function offsetSet(mixed $offset, mixed $value): void
428    {
429        if (is_null($offset)) {
430            $this->container[] = $value;
431        } else {
432            $this->container[$offset] = $value;
433        }
434    }
435
436    /**
437     * Unsets offset.
438     *
439     * @param int|string $offset Offset
440     *
441     */
442    public function offsetUnset(mixed $offset): void
443    {
444        unset($this->container[$offset]);
445    }
446
447    /**
448     * Serializes the object to a value that can be serialized natively by json_encode().
449     *
450     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
451     *
452     * @return mixed returns data which can be serialized by json_encode(), which is a value
453     *               of any type other than a resource
454     */
455    #[\ReturnTypeWillChange]
456    public function jsonSerialize(): mixed
457    {
458        return ObjectSerializer::sanitizeForSerialization($this);
459    }
460
461    /**
462     * Gets a header-safe presentation of the object.
463     *
464     */
465    public function toHeaderValue(): string
466    {
467        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
468    }
469
470    /**
471     * Array of nullable properties.
472     */
473    protected static function openAPINullables(): array
474    {
475        return self::$openAPINullables;
476    }
477
478    /**
479     * Array of nullable field names deliberately set to null.
480     *
481     * @return bool[]
482     */
483    private function getOpenAPINullablesSetToNull(): array
484    {
485        return $this->openAPINullablesSetToNull;
486    }
487
488    /**
489     * Setter - Array of nullable field names deliberately set to null.
490     *
491     * @param bool[] $openAPINullablesSetToNull
492     *
493     * @codeCoverageIgnore
494     */
495    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
496    {
497        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
498    }
499
500    /**
501     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
502     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
503     * $this->openAPINullablesSetToNull array.
504     *
505     * @noinspection PhpSameParameterValueInspection
506     */
507    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
508    {
509        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
510            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
511        }
512
513        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
514    }
515}