-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDevice.php
More file actions
81 lines (68 loc) · 2.3 KB
/
Copy pathDevice.php
File metadata and controls
81 lines (68 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
declare(strict_types=1);
namespace MaxMind\MinFraud\Model;
/**
* Model with information about the device.
*
* In order to receive device output from minFraud Insights or minFraud
* Factors, you must be using the Device Tracking Add-on.
*
* @link https://dev.maxmind.com/minfraud/track-devices/?lang=en Device Tracking
* Add-on
*/
class Device implements \JsonSerializable
{
/**
* @var float|null This number represents our confidence that
* the `device_id` refers to a unique device as opposed to a cluster of
* similar devices. A confidence of 0.01 indicates very low confidence that
* the device is unique, whereas 99 indicates very high confidence.
*/
public readonly ?float $confidence;
/**
* @var string|null a UUID that MaxMind uses for the device associated
* with this IP address
*/
public readonly ?string $id;
/**
* @var string|null This is the date and time of the last
* sighting of the device. This is an RFC 3339 date-time.
*/
public readonly ?string $lastSeen;
/**
* @var string|null This is the local date and time of
* the transaction in the time zone of the device. This is determined by using
* the UTC offset associated with the device. This is an RFC 3339 date-time
*/
public readonly ?string $localTime;
/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->confidence = $response['confidence'] ?? null;
$this->id = $response['id'] ?? null;
$this->lastSeen = $response['last_seen'] ?? null;
$this->localTime = $response['local_time'] ?? null;
}
/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
if ($this->confidence !== null) {
$js['confidence'] = $this->confidence;
}
if ($this->id !== null) {
$js['id'] = $this->id;
}
if ($this->lastSeen !== null) {
$js['last_seen'] = $this->lastSeen;
}
if ($this->localTime !== null) {
$js['local_time'] = $this->localTime;
}
return $js;
}
}