Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
19 / 19 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
ProxyType | |
100.00% |
19 / 19 |
|
100.00% |
8 / 8 |
8 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
isAnonymousVpn | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isPublicProxy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isResidentialProxy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isLegitimateProxy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isTorExitNode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isHostingProvider | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\IPInfo\Info; |
4 | |
5 | use JsonSerializable; |
6 | |
7 | class ProxyType implements JsonSerializable { |
8 | /** @var bool|null */ |
9 | private $isAnonymousVpn; |
10 | |
11 | /** @var bool|null */ |
12 | private $isPublicProxy; |
13 | |
14 | /** @var bool|null */ |
15 | private $isResidentialProxy; |
16 | |
17 | /** @var bool|null */ |
18 | private $isLegitimateProxy; |
19 | |
20 | /** @var bool|null */ |
21 | private $isTorExitNode; |
22 | |
23 | /** @var bool|null */ |
24 | private $isHostingProvider; |
25 | |
26 | /** |
27 | * @param bool|null $isAnonymousVpn |
28 | * @param bool|null $isPublicProxy |
29 | * @param bool|null $isResidentialProxy |
30 | * @param bool|null $isLegitimateProxy |
31 | * @param bool|null $isTorExitNode |
32 | * @param bool|null $isHostingProvider |
33 | */ |
34 | public function __construct( |
35 | ?bool $isAnonymousVpn, |
36 | ?bool $isPublicProxy, |
37 | ?bool $isResidentialProxy, |
38 | ?bool $isLegitimateProxy, |
39 | ?bool $isTorExitNode, |
40 | ?bool $isHostingProvider |
41 | ) { |
42 | $this->isAnonymousVpn = $isAnonymousVpn; |
43 | $this->isPublicProxy = $isPublicProxy; |
44 | $this->isResidentialProxy = $isResidentialProxy; |
45 | $this->isLegitimateProxy = $isLegitimateProxy; |
46 | $this->isTorExitNode = $isTorExitNode; |
47 | $this->isHostingProvider = $isHostingProvider; |
48 | } |
49 | |
50 | public function isAnonymousVpn(): ?bool { |
51 | return $this->isAnonymousVpn; |
52 | } |
53 | |
54 | public function isPublicProxy(): ?bool { |
55 | return $this->isPublicProxy; |
56 | } |
57 | |
58 | public function isResidentialProxy(): ?bool { |
59 | return $this->isResidentialProxy; |
60 | } |
61 | |
62 | public function isLegitimateProxy(): ?bool { |
63 | return $this->isLegitimateProxy; |
64 | } |
65 | |
66 | public function isTorExitNode(): ?bool { |
67 | return $this->isTorExitNode; |
68 | } |
69 | |
70 | public function isHostingProvider(): ?bool { |
71 | return $this->isHostingProvider; |
72 | } |
73 | |
74 | public function jsonSerialize(): array { |
75 | return [ |
76 | 'isAnonymousVpn' => $this->isAnonymousVpn(), |
77 | 'isResidentialProxy' => $this->isResidentialProxy(), |
78 | 'isLegitimateProxy' => $this->isLegitimateProxy(), |
79 | 'isTorExitNode' => $this->isTorExitNode(), |
80 | 'isHostingProvider' => $this->isHostingProvider(), |
81 | ]; |
82 | } |
83 | } |