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