Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
29 / 29
100.00% covered (success)
100.00%
11 / 11
CRAP
100.00% covered (success)
100.00%
1 / 1
Info
100.00% covered (success)
100.00%
29 / 29
100.00% covered (success)
100.00%
11 / 11
11
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
 getCoordinates
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAsn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOrganization
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCountryNames
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLocation
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIsp
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConnectionType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUserType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getProxyType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\IPInfo\Info;
4
5use JsonSerializable;
6
7class Info implements JsonSerializable {
8    /** @var Coordinates|null */
9    private $coordinates;
10
11    /** @var int|null */
12    private $asn;
13
14    /** @var string|null */
15    private $organization;
16
17    /** @var array|null */
18    private $countryNames;
19
20    /** @var array|null */
21    private $location;
22
23    /** @var string|null */
24    private $isp;
25
26    /** @var string|null */
27    private $connectionType;
28
29    /** @var string|null */
30    private $userType;
31
32    /** @var ProxyType|null */
33    private $proxyType;
34
35    /**
36     * @param Coordinates|null $coordinates
37     * @param int|null $asn
38     * @param string|null $organization
39     * @param array|null $countryNames
40     * @param Location[]|null $location
41     * @param string|null $isp
42     * @param string|null $connectionType
43     * @param string|null $userType
44     * @param ProxyType|null $proxyType
45     */
46    public function __construct(
47        ?Coordinates $coordinates = null,
48        ?int $asn = null,
49        ?string $organization = null,
50        ?array $countryNames = null,
51        ?array $location = null,
52        ?string $isp = null,
53        ?string $connectionType = null,
54        ?string $userType = null,
55        ?ProxyType $proxyType = null
56    ) {
57        $this->coordinates = $coordinates;
58        $this->asn = $asn;
59        $this->organization = $organization;
60        $this->countryNames = $countryNames;
61        $this->location = $location;
62        $this->isp = $isp;
63        $this->connectionType = $connectionType;
64        $this->userType = $userType;
65        $this->proxyType = $proxyType;
66    }
67
68    /**
69     * @return Coordinates|null
70     */
71    public function getCoordinates(): ?Coordinates {
72        return $this->coordinates;
73    }
74
75    /**
76     * @return int|null
77     */
78    public function getAsn(): ?int {
79        return $this->asn;
80    }
81
82    /**
83     * @return string|null
84     */
85    public function getOrganization(): ?string {
86        return $this->organization;
87    }
88
89    /**
90     * @return array|null
91     */
92    public function getCountryNames(): ?array {
93        return $this->countryNames;
94    }
95
96    /**
97     * @return Location[]|null
98     */
99    public function getLocation(): ?array {
100        return $this->location;
101    }
102
103    /**
104     * @return string|null
105     */
106    public function getIsp(): ?string {
107        return $this->isp;
108    }
109
110    /**
111     * @return string|null
112     */
113    public function getConnectionType(): ?string {
114        return $this->connectionType;
115    }
116
117    /**
118     * @return string|null
119     */
120    public function getUserType(): ?string {
121        return $this->userType;
122    }
123
124    /**
125     * @return ProxyType|null
126     */
127    public function getProxyType(): ?ProxyType {
128        return $this->proxyType;
129    }
130
131    public function jsonSerialize(): array {
132        return [
133            'coordinates' => $this->getCoordinates(),
134            'asn' => $this->getAsn(),
135            'organization' => $this->getOrganization(),
136            'countryNames' => $this->getCountryNames(),
137            'location' => $this->getLocation(),
138            'isp' => $this->getIsp(),
139            'connectionType' => $this->getConnectionType(),
140            'userType' => $this->getUserType(),
141            'proxyType' => $this->getProxyType(),
142        ];
143    }
144}