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