Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
20 / 20 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
IPoidInfo | |
100.00% |
20 / 20 |
|
100.00% |
8 / 8 |
8 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
getBehaviors | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getRisks | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getConnectionTypes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTunnelOperators | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getProxies | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNumUsersOnThisIP | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\IPInfo\Info; |
4 | |
5 | use JsonSerializable; |
6 | |
7 | class IPoidInfo implements JsonSerializable { |
8 | |
9 | /** @var string[]|null */ |
10 | private $behaviors; |
11 | |
12 | /** @var string[]|null */ |
13 | private $risks; |
14 | |
15 | /** @var string[]|null */ |
16 | private $connectionTypes; |
17 | |
18 | /** @var string[]|null */ |
19 | private $tunnelOperators; |
20 | |
21 | /** @var string[]|null */ |
22 | private $proxies; |
23 | |
24 | /** @var int|null */ |
25 | private $numUsersOnThisIP; |
26 | |
27 | /** |
28 | * @param string[]|null $behaviors |
29 | * @param string[]|null $risks |
30 | * @param string[]|null $connectionTypes |
31 | * @param string[]|null $tunnelOperators |
32 | * @param string[]|null $proxies |
33 | * @param int|null $numUsersOnThisIP |
34 | */ |
35 | public function __construct( |
36 | ?array $behaviors = null, |
37 | ?array $risks = null, |
38 | ?array $connectionTypes = null, |
39 | ?array $tunnelOperators = null, |
40 | ?array $proxies = null, |
41 | ?int $numUsersOnThisIP = null |
42 | ) { |
43 | $this->behaviors = $behaviors; |
44 | $this->risks = $risks; |
45 | $this->connectionTypes = $connectionTypes; |
46 | $this->tunnelOperators = $tunnelOperators; |
47 | $this->proxies = $proxies; |
48 | $this->numUsersOnThisIP = $numUsersOnThisIP; |
49 | } |
50 | |
51 | /** |
52 | * @return string[]|null |
53 | */ |
54 | public function getBehaviors(): ?array { |
55 | return $this->behaviors; |
56 | } |
57 | |
58 | /** |
59 | * @return string[]|null |
60 | */ |
61 | public function getRisks(): ?array { |
62 | return $this->risks; |
63 | } |
64 | |
65 | /** |
66 | * @return string[]|null |
67 | */ |
68 | public function getConnectionTypes(): ?array { |
69 | return $this->connectionTypes; |
70 | } |
71 | |
72 | /** |
73 | * @return string[]|null |
74 | */ |
75 | public function getTunnelOperators(): ?array { |
76 | return $this->tunnelOperators; |
77 | } |
78 | |
79 | /** |
80 | * @return string[]|null |
81 | */ |
82 | public function getProxies(): ?array { |
83 | return $this->proxies; |
84 | } |
85 | |
86 | public function getNumUsersOnThisIP(): ?int { |
87 | return $this->numUsersOnThisIP; |
88 | } |
89 | |
90 | public function jsonSerialize(): array { |
91 | return [ |
92 | 'behaviors' => $this->getBehaviors(), |
93 | 'risks' => $this->getRisks(), |
94 | 'connectionTypes' => $this->getConnectionTypes(), |
95 | 'tunnelOperators' => $this->getTunnelOperators(), |
96 | 'proxies' => $this->getProxies(), |
97 | 'numUsersOnThisIP' => $this->getNumUsersOnThisIP(), |
98 | ]; |
99 | } |
100 | } |