Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.00% covered (success)
92.00%
46 / 50
90.91% covered (success)
90.91%
30 / 33
CRAP
0.00% covered (danger)
0.00%
0 / 1
VpnMethods
92.00% covered (success)
92.00%
46 / 50
90.91% covered (success)
90.91%
30 / 33
38.74
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
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%
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
 getTimezoneMismatch
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTimezoneMismatch
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPublicVpn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPublicVpn
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getAuxiliaryMobile
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setAuxiliaryMobile
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getOsMismatch
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setOsMismatch
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRelay
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRelay
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getMlPrediction
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setMlPrediction
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 * VpnMethods.
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. The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
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.23.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 * VpnMethods 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 VpnMethods 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 = 'VpnMethods';
57
58    /**
59     * Array of property to type mappings. Used for (de)serialization.
60     *
61     * @var string[]
62     */
63    protected static array $openAPITypes = [
64        'timezone_mismatch' => 'bool',
65        'public_vpn' => 'bool',
66        'auxiliary_mobile' => 'bool',
67        'os_mismatch' => 'bool',
68        'relay' => 'bool',
69        'ml_prediction' => 'bool',
70    ];
71
72    /**
73     * Array of property to format mappings. Used for (de)serialization.
74     *
75     * @var string[]
76     *
77     * @phpstan-var array<string, string|null>
78     *
79     * @psalm-var array<string, string|null>
80     */
81    protected static array $openAPIFormats = [
82        'timezone_mismatch' => null,
83        'public_vpn' => null,
84        'auxiliary_mobile' => null,
85        'os_mismatch' => null,
86        'relay' => null,
87        'ml_prediction' => null,
88    ];
89
90    /**
91     * Array of nullable properties. Used for (de)serialization.
92     *
93     * @var bool[]
94     */
95    protected static array $openAPINullables = [
96        'timezone_mismatch' => false,
97        'public_vpn' => false,
98        'auxiliary_mobile' => false,
99        'os_mismatch' => false,
100        'relay' => false,
101        'ml_prediction' => false,
102    ];
103
104    /**
105     * If a nullable field gets set to null, insert it here.
106     *
107     * @var bool[]
108     */
109    protected array $openAPINullablesSetToNull = [];
110
111    /**
112     * Array of attributes where the key is the local name,
113     * and the value is the original name.
114     *
115     * @var string[]
116     */
117    protected static array $attributeMap = [
118        'timezone_mismatch' => 'timezone_mismatch',
119        'public_vpn' => 'public_vpn',
120        'auxiliary_mobile' => 'auxiliary_mobile',
121        'os_mismatch' => 'os_mismatch',
122        'relay' => 'relay',
123        'ml_prediction' => 'ml_prediction',
124    ];
125
126    /**
127     * Array of attributes to setter functions (for deserialization of responses).
128     *
129     * @var string[]
130     */
131    protected static array $setters = [
132        'timezone_mismatch' => 'setTimezoneMismatch',
133        'public_vpn' => 'setPublicVpn',
134        'auxiliary_mobile' => 'setAuxiliaryMobile',
135        'os_mismatch' => 'setOsMismatch',
136        'relay' => 'setRelay',
137        'ml_prediction' => 'setMlPrediction',
138    ];
139
140    /**
141     * Array of attributes to getter functions (for serialization of requests).
142     *
143     * @var string[]
144     */
145    protected static array $getters = [
146        'timezone_mismatch' => 'getTimezoneMismatch',
147        'public_vpn' => 'getPublicVpn',
148        'auxiliary_mobile' => 'getAuxiliaryMobile',
149        'os_mismatch' => 'getOsMismatch',
150        'relay' => 'getRelay',
151        'ml_prediction' => 'getMlPrediction',
152    ];
153
154    /**
155     * Associative array for storing property values.
156     */
157    protected array $container = [];
158
159    /**
160     * Constructor.
161     *
162     * @param array|null $data Associated array of property values
163     *                         initializing the model
164     *
165     * @noinspection DuplicatedCode
166     */
167    public function __construct(?array $data = null)
168    {
169        $this->setIfExists('timezone_mismatch', $data ?? [], null);
170        $this->setIfExists('public_vpn', $data ?? [], null);
171        $this->setIfExists('auxiliary_mobile', $data ?? [], null);
172        $this->setIfExists('os_mismatch', $data ?? [], null);
173        $this->setIfExists('relay', $data ?? [], null);
174        $this->setIfExists('ml_prediction', $data ?? [], null);
175    }
176
177    /**
178     * Gets the string presentation of the object.
179     *
180     */
181    public function __toString(): string
182    {
183        return json_encode(
184            ObjectSerializer::sanitizeForSerialization($this),
185            JSON_PRETTY_PRINT
186        );
187    }
188
189    /**
190     * Array of property to type mappings. Used for (de)serialization.
191     *
192     */
193    public static function openAPITypes(): array
194    {
195        return self::$openAPITypes;
196    }
197
198    /**
199     * Array of property to format mappings. Used for (de)serialization.
200     */
201    public static function openAPIFormats(): array
202    {
203        return self::$openAPIFormats;
204    }
205
206    /**
207     * Checks if a property is nullable.
208     *
209     */
210    public static function isNullable(string $property): bool
211    {
212        return self::openAPINullables()[$property] ?? false;
213    }
214
215    /**
216     * Checks if a nullable property is set to null.
217     *
218     */
219    public function isNullableSetToNull(string $property): bool
220    {
221        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
222    }
223
224    /**
225     * Array of attributes where the key is the local name,
226     * and the value is the original name.
227     *
228     */
229    public static function attributeMap(): array
230    {
231        return self::$attributeMap;
232    }
233
234    /**
235     * Array of attributes to setter functions (for deserialization of responses).
236     *
237     */
238    public static function setters(): array
239    {
240        return self::$setters;
241    }
242
243    /**
244     * Array of attributes to getter functions (for serialization of requests).
245     *
246     */
247    public static function getters(): array
248    {
249        return self::$getters;
250    }
251
252    /**
253     * The original name of the model.
254     *
255     */
256    public function getModelName(): string
257    {
258        return self::$openAPIModelName;
259    }
260
261    /**
262     * Show all the invalid properties with reasons.
263     *
264     * @return array invalid properties with reasons
265     */
266    public function listInvalidProperties(): array
267    {
268        return [];
269    }
270
271    /**
272     * Validate all the properties in the model
273     * return true if all passed.
274     *
275     * @return bool True if all properties are valid
276     */
277    public function valid(): bool
278    {
279        return 0 === count($this->listInvalidProperties());
280    }
281
282    /**
283     * Gets timezone_mismatch.
284     *
285     */
286    public function getTimezoneMismatch(): ?bool
287    {
288        return $this->container['timezone_mismatch'];
289    }
290
291    /**
292     * Sets timezone_mismatch.
293     *
294     * @param bool $timezone_mismatch the browser timezone doesn't match the timezone inferred from the request IP address
295     *
296     */
297    public function setTimezoneMismatch(bool $timezone_mismatch): self
298    {
299        $this->container['timezone_mismatch'] = $timezone_mismatch;
300
301        return $this;
302    }
303
304    /**
305     * Gets public_vpn.
306     *
307     */
308    public function getPublicVpn(): ?bool
309    {
310        return $this->container['public_vpn'];
311    }
312
313    /**
314     * Sets public_vpn.
315     *
316     * @param bool $public_vpn request IP address is owned and used by a public VPN service provider
317     *
318     */
319    public function setPublicVpn(bool $public_vpn): self
320    {
321        $this->container['public_vpn'] = $public_vpn;
322
323        return $this;
324    }
325
326    /**
327     * Gets auxiliary_mobile.
328     *
329     */
330    public function getAuxiliaryMobile(): ?bool
331    {
332        return $this->container['auxiliary_mobile'];
333    }
334
335    /**
336     * Sets auxiliary_mobile.
337     *
338     * @param bool $auxiliary_mobile This method applies to mobile devices only. Indicates the result of additional methods used to detect a VPN in mobile devices.
339     *
340     */
341    public function setAuxiliaryMobile(bool $auxiliary_mobile): self
342    {
343        $this->container['auxiliary_mobile'] = $auxiliary_mobile;
344
345        return $this;
346    }
347
348    /**
349     * Gets os_mismatch.
350     *
351     */
352    public function getOsMismatch(): ?bool
353    {
354        return $this->container['os_mismatch'];
355    }
356
357    /**
358     * Sets os_mismatch.
359     *
360     * @param bool $os_mismatch the browser runs on a different operating system than the operating system inferred from the request network signature
361     *
362     */
363    public function setOsMismatch(bool $os_mismatch): self
364    {
365        $this->container['os_mismatch'] = $os_mismatch;
366
367        return $this;
368    }
369
370    /**
371     * Gets relay.
372     *
373     */
374    public function getRelay(): ?bool
375    {
376        return $this->container['relay'];
377    }
378
379    /**
380     * Sets relay.
381     *
382     * @param bool $relay Request IP address belongs to a relay service provider, indicating the use of relay services like [Apple Private relay](https://support.apple.com/en-us/102602) or [Cloudflare Warp](https://developers.cloudflare.com/warp-client/).  * Like VPNs, relay services anonymize the visitor's true IP address. * Unlike traditional VPNs, relay services don't let visitors spoof their location by choosing an exit node in a different country.  This field allows you to differentiate VPN users and relay service users in your fraud prevention logic.
383     *
384     */
385    public function setRelay(bool $relay): self
386    {
387        $this->container['relay'] = $relay;
388
389        return $this;
390    }
391
392    /**
393     * Gets ml_prediction.
394     *
395     */
396    public function getMlPrediction(): ?bool
397    {
398        return $this->container['ml_prediction'];
399    }
400
401    /**
402     * Sets ml_prediction.
403     *
404     * @param bool $ml_prediction `true` if the request came from a device running a VPN, `false` otherwise
405     *
406     */
407    public function setMlPrediction(bool $ml_prediction): self
408    {
409        $this->container['ml_prediction'] = $ml_prediction;
410
411        return $this;
412    }
413
414    /**
415     * Returns true if offset exists. False otherwise.
416     *
417     * @param int|string $offset Offset
418     *
419     */
420    public function offsetExists(mixed $offset): bool
421    {
422        return isset($this->container[$offset]);
423    }
424
425    /**
426     * Gets offset.
427     *
428     * @param int|string $offset Offset
429     *
430     * @return mixed|null
431     */
432    #[\ReturnTypeWillChange]
433    public function offsetGet(mixed $offset): mixed
434    {
435        return $this->container[$offset] ?? null;
436    }
437
438    /**
439     * Sets value based on offset.
440     *
441     * @param int|null $offset Offset
442     * @param mixed    $value  Value to be set
443     *
444     */
445    public function offsetSet(mixed $offset, mixed $value): void
446    {
447        if (is_null($offset)) {
448            $this->container[] = $value;
449        } else {
450            $this->container[$offset] = $value;
451        }
452    }
453
454    /**
455     * Unsets offset.
456     *
457     * @param int|string $offset Offset
458     *
459     */
460    public function offsetUnset(mixed $offset): void
461    {
462        unset($this->container[$offset]);
463    }
464
465    /**
466     * Serializes the object to a value that can be serialized natively by json_encode().
467     *
468     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
469     *
470     * @return mixed returns data which can be serialized by json_encode(), which is a value
471     *               of any type other than a resource
472     */
473    #[\ReturnTypeWillChange]
474    public function jsonSerialize(): mixed
475    {
476        return ObjectSerializer::sanitizeForSerialization($this);
477    }
478
479    /**
480     * Gets a header-safe presentation of the object.
481     *
482     */
483    public function toHeaderValue(): string
484    {
485        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
486    }
487
488    /**
489     * Array of nullable properties.
490     */
491    protected static function openAPINullables(): array
492    {
493        return self::$openAPINullables;
494    }
495
496    /**
497     * Array of nullable field names deliberately set to null.
498     *
499     * @return bool[]
500     */
501    private function getOpenAPINullablesSetToNull(): array
502    {
503        return $this->openAPINullablesSetToNull;
504    }
505
506    /**
507     * Setter - Array of nullable field names deliberately set to null.
508     *
509     * @param bool[] $openAPINullablesSetToNull
510     *
511     * @codeCoverageIgnore
512     */
513    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
514    {
515        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
516    }
517
518    /**
519     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
520     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
521     * $this->openAPINullablesSetToNull array.
522     *
523     * @noinspection PhpSameParameterValueInspection
524     */
525    private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
526    {
527        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
528            $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore
529        }
530
531        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
532    }
533}