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