Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
38.71% covered (danger)
38.71%
24 / 62
31.82% covered (danger)
31.82%
7 / 22
CRAP
0.00% covered (danger)
0.00%
0 / 1
Proximity
38.71% covered (danger)
38.71%
24 / 62
31.82% covered (danger)
31.82%
7 / 22
283.73
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
4
 __toString
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 swaggerTypes
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 swaggerFormats
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
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
 getPrecisionRadiusAllowableValues
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
 listInvalidProperties
0.00% covered (danger)
0.00%
0 / 14
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
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPrecisionRadius
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setPrecisionRadius
40.00% covered (danger)
40.00%
4 / 10
0.00% covered (danger)
0.00%
0 / 1
2.86
 getConfidence
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setConfidence
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 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
6
 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
 toPrettyString
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Proximity.
4 *
5 * @category Class
6 *
7 * @author   Swagger Codegen team
8 *
9 * @see     https://github.com/swagger-api/swagger-codegen
10 */
11
12/**
13 * Fingerprint Server API.
14 *
15 * Fingerprint Server API allows you to search, update, and delete identification 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.
16 *
17 * OpenAPI spec version: 3
18 * Contact: support@fingerprint.com
19 * Generated by: https://github.com/swagger-api/swagger-codegen.git
20 * Swagger Codegen version: 3.0.34
21 */
22/**
23 * NOTE: This class is auto generated by the swagger code generator program.
24 * https://github.com/swagger-api/swagger-codegen
25 * Do not edit the class manually.
26 */
27
28namespace Fingerprint\ServerAPI\Model;
29
30use Fingerprint\ServerAPI\ObjectSerializer;
31
32/**
33 * Proximity Class Doc Comment.
34 *
35 * @category Class
36 *
37 * @description Proximity ID represents a fixed geographical zone in a discrete global grid within which the device is observed.
38 *
39 * @author   Swagger Codegen team
40 *
41 * @see     https://github.com/swagger-api/swagger-codegen
42 */
43class Proximity implements ModelInterface, \ArrayAccess
44{
45    public const PRECISION_RADIUS_10 = 10;
46    public const PRECISION_RADIUS_25 = 25;
47    public const PRECISION_RADIUS_65 = 65;
48    public const PRECISION_RADIUS_175 = 175;
49    public const PRECISION_RADIUS_450 = 450;
50    public const PRECISION_RADIUS_1200 = 1200;
51    public const PRECISION_RADIUS_3300 = 3300;
52    public const PRECISION_RADIUS_8500 = 8500;
53    public const PRECISION_RADIUS_22500 = 22500;
54
55    /**
56     * The original name of the model.
57     *
58     */
59    protected static string $swaggerModelName = 'Proximity';
60
61    /**
62     * Array of property to type mappings. Used for (de)serialization.
63     *
64     * @var string[]
65     */
66    protected static array $swaggerTypes = [
67        'id' => 'string',
68        'precision_radius' => 'int',
69        'confidence' => 'float'];
70
71    /**
72     * Array of property to format mappings. Used for (de)serialization.
73     *
74     * @var string[]
75     */
76    protected static array $swaggerFormats = [
77        'id' => null,
78        'precision_radius' => 'int32',
79        'confidence' => 'float'];
80
81    /**
82     * Array of attributes where the key is the local name,
83     * and the value is the original name.
84     *
85     * @var string[]
86     */
87    protected static array $attributeMap = [
88        'id' => 'id',
89        'precision_radius' => 'precisionRadius',
90        'confidence' => 'confidence'];
91
92    /**
93     * Array of attributes to setter functions (for deserialization of responses).
94     *
95     * @var string[]
96     */
97    protected static array $setters = [
98        'id' => 'setId',
99        'precision_radius' => 'setPrecisionRadius',
100        'confidence' => 'setConfidence'];
101
102    /**
103     * Array of attributes to getter functions (for serialization of requests).
104     *
105     * @var string[]
106     */
107    protected static array $getters = [
108        'id' => 'getId',
109        'precision_radius' => 'getPrecisionRadius',
110        'confidence' => 'getConfidence'];
111
112    /**
113     * Associative array for storing property values.
114     *
115     * @var mixed[]
116     */
117    protected array $container = [];
118
119    /**
120     * Constructor.
121     *
122     * @param mixed[] $data Associated array of property values
123     *                      initializing the model
124     */
125    public function __construct(?array $data = null)
126    {
127        $this->container['id'] = isset($data['id']) ? $data['id'] : null;
128        $this->container['precision_radius'] = isset($data['precision_radius']) ? $data['precision_radius'] : null;
129        $this->container['confidence'] = isset($data['confidence']) ? $data['confidence'] : null;
130    }
131
132    /**
133     * Gets the string presentation of the object.
134     *
135     */
136    public function __toString(): string
137    {
138        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
139    }
140
141    /**
142     * Array of property to type mappings. Used for (de)serialization.
143     */
144    public static function swaggerTypes(): array
145    {
146        return self::$swaggerTypes;
147    }
148
149    /**
150     * Array of property to format mappings. Used for (de)serialization.
151     */
152    public static function swaggerFormats(): array
153    {
154        return self::$swaggerFormats;
155    }
156
157    /**
158     * Array of attributes where the key is the local name,
159     * and the value is the original name.
160     */
161    public static function attributeMap(): array
162    {
163        return self::$attributeMap;
164    }
165
166    /**
167     * Array of attributes to setter functions (for deserialization of responses).
168     */
169    public static function setters(): array
170    {
171        return self::$setters;
172    }
173
174    /**
175     * Array of attributes to getter functions (for serialization of requests).
176     */
177    public static function getters(): array
178    {
179        return self::$getters;
180    }
181
182    /**
183     * The original name of the model.
184     */
185    public function getModelName(): string
186    {
187        return self::$swaggerModelName;
188    }
189
190    /**
191     * Gets allowable values of the enum.
192     *
193     * @return string[]
194     */
195    public function getPrecisionRadiusAllowableValues(): array
196    {
197        return [
198            self::PRECISION_RADIUS_10,
199            self::PRECISION_RADIUS_25,
200            self::PRECISION_RADIUS_65,
201            self::PRECISION_RADIUS_175,
202            self::PRECISION_RADIUS_450,
203            self::PRECISION_RADIUS_1200,
204            self::PRECISION_RADIUS_3300,
205            self::PRECISION_RADIUS_8500,
206            self::PRECISION_RADIUS_22500,        ];
207    }
208
209    /**
210     * Show all the invalid properties with reasons.
211     *
212     * @return array invalid properties with reasons
213     */
214    public function listInvalidProperties(): array
215    {
216        $invalidProperties = [];
217
218        if (null === $this->container['id']) {
219            $invalidProperties[] = "'id' can't be null";
220        }
221        if (null === $this->container['precision_radius']) {
222            $invalidProperties[] = "'precision_radius' can't be null";
223        }
224        $allowedValues = $this->getPrecisionRadiusAllowableValues();
225        if (!is_null($this->container['precision_radius']) && !in_array($this->container['precision_radius'], $allowedValues, true)) {
226            $invalidProperties[] = sprintf(
227                "invalid value for 'precision_radius', must be one of '%s'",
228                implode("', '", $allowedValues)
229            );
230        }
231
232        if (null === $this->container['confidence']) {
233            $invalidProperties[] = "'confidence' can't be null";
234        }
235
236        return $invalidProperties;
237    }
238
239    /**
240     * Validate all the properties in the model
241     * return true if all passed.
242     *
243     * @return bool True if all properties are valid
244     */
245    public function valid(): bool
246    {
247        return 0 === count($this->listInvalidProperties());
248    }
249
250    /**
251     * Gets id.
252     */
253    public function getId(): string
254    {
255        return $this->container['id'];
256    }
257
258    /**
259     * Sets id.
260     *
261     * @param string $id a stable privacy-preserving identifier for a given proximity zone
262     *
263     * @return $this
264     */
265    public function setId(string $id): self
266    {
267        $this->container['id'] = $id;
268
269        return $this;
270    }
271
272    /**
273     * Gets precision_radius.
274     */
275    public function getPrecisionRadius(): int
276    {
277        return $this->container['precision_radius'];
278    }
279
280    /**
281     * Sets precision_radius.
282     *
283     * @param int $precision_radius the radius of the proximity zone’s precision level, in meters
284     *
285     * @return $this
286     */
287    public function setPrecisionRadius(int $precision_radius): self
288    {
289        $allowedValues = $this->getPrecisionRadiusAllowableValues();
290        if (!in_array($precision_radius, $allowedValues, true)) {
291            throw new \InvalidArgumentException(
292                sprintf(
293                    "Invalid value for 'precision_radius', must be one of '%s'",
294                    implode("', '", $allowedValues)
295                )
296            );
297        }
298        $this->container['precision_radius'] = $precision_radius;
299
300        return $this;
301    }
302
303    /**
304     * Gets confidence.
305     */
306    public function getConfidence(): float
307    {
308        return $this->container['confidence'];
309    }
310
311    /**
312     * Sets confidence.
313     *
314     * @param float $confidence A value between `0` and `1` representing the likelihood that the true device location lies within the mapped proximity zone.   * Scores closer to `1` indicate high confidence that the location is inside the mapped proximity zone.   * Scores closer to `0` indicate lower confidence, suggesting the true location may fall in an adjacent zone.
315     *
316     * @return $this
317     */
318    public function setConfidence(float $confidence): self
319    {
320        $this->container['confidence'] = $confidence;
321
322        return $this;
323    }
324
325    /**
326     * Returns true if offset exists. False otherwise.
327     *
328     * @param int $offset Offset
329     */
330    public function offsetExists($offset): bool
331    {
332        return isset($this->container[$offset]);
333    }
334
335    /**
336     * Gets offset.
337     *
338     * @param int $offset Offset
339     */
340    public function offsetGet($offset): mixed
341    {
342        return isset($this->container[$offset]) ? $this->container[$offset] : null;
343    }
344
345    /**
346     * Sets value based on offset.
347     *
348     * @param int   $offset Offset
349     * @param mixed $value  Value to be set
350     */
351    public function offsetSet($offset, mixed $value): void
352    {
353        if (is_null($offset)) {
354            $this->container[] = $value;
355        } else {
356            $this->container[$offset] = $value;
357        }
358    }
359
360    /**
361     * Unsets offset.
362     *
363     * @param int $offset Offset
364     */
365    public function offsetUnset($offset): void
366    {
367        unset($this->container[$offset]);
368    }
369
370    /**
371     * Gets the string presentation of the object in a pretty JSON format.
372     *
373     */
374    public function toPrettyString(): string
375    {
376        return json_encode(
377            ObjectSerializer::sanitizeForSerialization($this),
378            JSON_PRETTY_PRINT
379        );
380    }
381}