Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
29.79% covered (danger)
29.79%
14 / 47
30.00% covered (danger)
30.00%
6 / 20
CRAP
0.00% covered (danger)
0.00%
0 / 1
ProxyDetails
29.79% covered (danger)
29.79%
14 / 47
30.00% covered (danger)
30.00%
6 / 20
299.37
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
3
 __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
 getProxyTypeAllowableValues
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 listInvalidProperties
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
20
 valid
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getProxyType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setProxyType
40.00% covered (danger)
40.00%
4 / 10
0.00% covered (danger)
0.00%
0 / 1
2.86
 getLastSeenAt
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setLastSeenAt
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 * ProxyDetails.
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 * ProxyDetails Class Doc Comment.
34 *
35 * @category Class
36 *
37 * @description Proxy detection details (present if proxy is detected)
38 *
39 * @author   Swagger Codegen team
40 *
41 * @see     https://github.com/swagger-api/swagger-codegen
42 */
43class ProxyDetails implements ModelInterface, \ArrayAccess
44{
45    public const PROXY_TYPE_RESIDENTIAL = 'residential';
46    public const PROXY_TYPE_DATA_CENTER = 'data_center';
47
48    /**
49     * The original name of the model.
50     *
51     */
52    protected static string $swaggerModelName = 'ProxyDetails';
53
54    /**
55     * Array of property to type mappings. Used for (de)serialization.
56     *
57     * @var string[]
58     */
59    protected static array $swaggerTypes = [
60        'proxy_type' => 'string',
61        'last_seen_at' => '\DateTime'];
62
63    /**
64     * Array of property to format mappings. Used for (de)serialization.
65     *
66     * @var string[]
67     */
68    protected static array $swaggerFormats = [
69        'proxy_type' => null,
70        'last_seen_at' => 'date-time'];
71
72    /**
73     * Array of attributes where the key is the local name,
74     * and the value is the original name.
75     *
76     * @var string[]
77     */
78    protected static array $attributeMap = [
79        'proxy_type' => 'proxyType',
80        'last_seen_at' => 'lastSeenAt'];
81
82    /**
83     * Array of attributes to setter functions (for deserialization of responses).
84     *
85     * @var string[]
86     */
87    protected static array $setters = [
88        'proxy_type' => 'setProxyType',
89        'last_seen_at' => 'setLastSeenAt'];
90
91    /**
92     * Array of attributes to getter functions (for serialization of requests).
93     *
94     * @var string[]
95     */
96    protected static array $getters = [
97        'proxy_type' => 'getProxyType',
98        'last_seen_at' => 'getLastSeenAt'];
99
100    /**
101     * Associative array for storing property values.
102     *
103     * @var mixed[]
104     */
105    protected array $container = [];
106
107    /**
108     * Constructor.
109     *
110     * @param mixed[] $data Associated array of property values
111     *                      initializing the model
112     */
113    public function __construct(?array $data = null)
114    {
115        $this->container['proxy_type'] = isset($data['proxy_type']) ? $data['proxy_type'] : null;
116        $this->container['last_seen_at'] = isset($data['last_seen_at']) ? $data['last_seen_at'] : null;
117    }
118
119    /**
120     * Gets the string presentation of the object.
121     *
122     */
123    public function __toString(): string
124    {
125        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
126    }
127
128    /**
129     * Array of property to type mappings. Used for (de)serialization.
130     */
131    public static function swaggerTypes(): array
132    {
133        return self::$swaggerTypes;
134    }
135
136    /**
137     * Array of property to format mappings. Used for (de)serialization.
138     */
139    public static function swaggerFormats(): array
140    {
141        return self::$swaggerFormats;
142    }
143
144    /**
145     * Array of attributes where the key is the local name,
146     * and the value is the original name.
147     */
148    public static function attributeMap(): array
149    {
150        return self::$attributeMap;
151    }
152
153    /**
154     * Array of attributes to setter functions (for deserialization of responses).
155     */
156    public static function setters(): array
157    {
158        return self::$setters;
159    }
160
161    /**
162     * Array of attributes to getter functions (for serialization of requests).
163     */
164    public static function getters(): array
165    {
166        return self::$getters;
167    }
168
169    /**
170     * The original name of the model.
171     */
172    public function getModelName(): string
173    {
174        return self::$swaggerModelName;
175    }
176
177    /**
178     * Gets allowable values of the enum.
179     *
180     * @return string[]
181     */
182    public function getProxyTypeAllowableValues(): array
183    {
184        return [
185            self::PROXY_TYPE_RESIDENTIAL,
186            self::PROXY_TYPE_DATA_CENTER,        ];
187    }
188
189    /**
190     * Show all the invalid properties with reasons.
191     *
192     * @return array invalid properties with reasons
193     */
194    public function listInvalidProperties(): array
195    {
196        $invalidProperties = [];
197
198        if (null === $this->container['proxy_type']) {
199            $invalidProperties[] = "'proxy_type' can't be null";
200        }
201        $allowedValues = $this->getProxyTypeAllowableValues();
202        if (!is_null($this->container['proxy_type']) && !in_array($this->container['proxy_type'], $allowedValues, true)) {
203            $invalidProperties[] = sprintf(
204                "invalid value for 'proxy_type', must be one of '%s'",
205                implode("', '", $allowedValues)
206            );
207        }
208
209        return $invalidProperties;
210    }
211
212    /**
213     * Validate all the properties in the model
214     * return true if all passed.
215     *
216     * @return bool True if all properties are valid
217     */
218    public function valid(): bool
219    {
220        return 0 === count($this->listInvalidProperties());
221    }
222
223    /**
224     * Gets proxy_type.
225     */
226    public function getProxyType(): string
227    {
228        return $this->container['proxy_type'];
229    }
230
231    /**
232     * Sets proxy_type.
233     *
234     * @param string $proxy_type Residential proxies use real user IP addresses to appear as legitimate traffic,  while data center proxies are public proxies hosted in data centers
235     *
236     * @return $this
237     */
238    public function setProxyType(string $proxy_type): self
239    {
240        $allowedValues = $this->getProxyTypeAllowableValues();
241        if (!in_array($proxy_type, $allowedValues, true)) {
242            throw new \InvalidArgumentException(
243                sprintf(
244                    "Invalid value for 'proxy_type', must be one of '%s'",
245                    implode("', '", $allowedValues)
246                )
247            );
248        }
249        $this->container['proxy_type'] = $proxy_type;
250
251        return $this;
252    }
253
254    /**
255     * Gets last_seen_at.
256     */
257    public function getLastSeenAt(): ?\DateTime
258    {
259        return $this->container['last_seen_at'];
260    }
261
262    /**
263     * Sets last_seen_at.
264     *
265     * @param ?\DateTime $last_seen_at ISO 8601 formatted timestamp in UTC with hourly resolution of when this IP was last seen as a proxy when available
266     *
267     * @return $this
268     */
269    public function setLastSeenAt(?\DateTime $last_seen_at): self
270    {
271        $this->container['last_seen_at'] = $last_seen_at;
272
273        return $this;
274    }
275
276    /**
277     * Returns true if offset exists. False otherwise.
278     *
279     * @param int $offset Offset
280     */
281    public function offsetExists($offset): bool
282    {
283        return isset($this->container[$offset]);
284    }
285
286    /**
287     * Gets offset.
288     *
289     * @param int $offset Offset
290     */
291    public function offsetGet($offset): mixed
292    {
293        return isset($this->container[$offset]) ? $this->container[$offset] : null;
294    }
295
296    /**
297     * Sets value based on offset.
298     *
299     * @param int   $offset Offset
300     * @param mixed $value  Value to be set
301     */
302    public function offsetSet($offset, mixed $value): void
303    {
304        if (is_null($offset)) {
305            $this->container[] = $value;
306        } else {
307            $this->container[$offset] = $value;
308        }
309    }
310
311    /**
312     * Unsets offset.
313     *
314     * @param int $offset Offset
315     */
316    public function offsetUnset($offset): void
317    {
318        unset($this->container[$offset]);
319    }
320
321    /**
322     * Gets the string presentation of the object in a pretty JSON format.
323     *
324     */
325    public function toPrettyString(): string
326    {
327        return json_encode(
328            ObjectSerializer::sanitizeForSerialization($this),
329            JSON_PRETTY_PRINT
330        );
331    }
332}