55namespace GeoIp2 \Database ;
66
77use GeoIp2 \Exception \AddressNotFoundException ;
8+ use GeoIp2 \Model \AbstractModel ;
89use GeoIp2 \ProviderInterface ;
910use MaxMind \Db \Reader as DbReader ;
1011use MaxMind \Db \Reader \InvalidDatabaseException ;
3536 */
3637class Reader implements ProviderInterface
3738{
39+ /**
40+ * @var DbReader
41+ */
3842 private $ dbReader ;
43+ /**
44+ * @var string
45+ */
3946 private $ dbType ;
47+ /**
48+ * @var array<string>
49+ */
4050 private $ locales ;
4151
4252 /**
@@ -70,6 +80,7 @@ public function __construct(
7080 */
7181 public function city (string $ ipAddress ): \GeoIp2 \Model \City
7282 {
83+ // @phpstan-ignore-next-line
7384 return $ this ->modelFor ('City ' , 'City ' , $ ipAddress );
7485 }
7586
@@ -85,6 +96,7 @@ public function city(string $ipAddress): \GeoIp2\Model\City
8596 */
8697 public function country (string $ ipAddress ): \GeoIp2 \Model \Country
8798 {
99+ // @phpstan-ignore-next-line
88100 return $ this ->modelFor ('Country ' , 'Country ' , $ ipAddress );
89101 }
90102
@@ -100,6 +112,7 @@ public function country(string $ipAddress): \GeoIp2\Model\Country
100112 */
101113 public function anonymousIp (string $ ipAddress ): \GeoIp2 \Model \AnonymousIp
102114 {
115+ // @phpstan-ignore-next-line
103116 return $ this ->flatModelFor (
104117 'AnonymousIp ' ,
105118 'GeoIP2-Anonymous-IP ' ,
@@ -119,6 +132,7 @@ public function anonymousIp(string $ipAddress): \GeoIp2\Model\AnonymousIp
119132 */
120133 public function asn (string $ ipAddress ): \GeoIp2 \Model \Asn
121134 {
135+ // @phpstan-ignore-next-line
122136 return $ this ->flatModelFor (
123137 'Asn ' ,
124138 'GeoLite2-ASN ' ,
@@ -138,6 +152,7 @@ public function asn(string $ipAddress): \GeoIp2\Model\Asn
138152 */
139153 public function connectionType (string $ ipAddress ): \GeoIp2 \Model \ConnectionType
140154 {
155+ // @phpstan-ignore-next-line
141156 return $ this ->flatModelFor (
142157 'ConnectionType ' ,
143158 'GeoIP2-Connection-Type ' ,
@@ -157,6 +172,7 @@ public function connectionType(string $ipAddress): \GeoIp2\Model\ConnectionType
157172 */
158173 public function domain (string $ ipAddress ): \GeoIp2 \Model \Domain
159174 {
175+ // @phpstan-ignore-next-line
160176 return $ this ->flatModelFor (
161177 'Domain ' ,
162178 'GeoIP2-Domain ' ,
@@ -176,6 +192,7 @@ public function domain(string $ipAddress): \GeoIp2\Model\Domain
176192 */
177193 public function enterprise (string $ ipAddress ): \GeoIp2 \Model \Enterprise
178194 {
195+ // @phpstan-ignore-next-line
179196 return $ this ->modelFor ('Enterprise ' , 'Enterprise ' , $ ipAddress );
180197 }
181198
@@ -191,14 +208,15 @@ public function enterprise(string $ipAddress): \GeoIp2\Model\Enterprise
191208 */
192209 public function isp (string $ ipAddress ): \GeoIp2 \Model \Isp
193210 {
211+ // @phpstan-ignore-next-line
194212 return $ this ->flatModelFor (
195213 'Isp ' ,
196214 'GeoIP2-ISP ' ,
197215 $ ipAddress
198216 );
199217 }
200218
201- private function modelFor (string $ class , string $ type , string $ ipAddress )
219+ private function modelFor (string $ class , string $ type , string $ ipAddress ): AbstractModel
202220 {
203221 list ($ record , $ prefixLen ) = $ this ->getRecord ($ class , $ type , $ ipAddress );
204222
@@ -210,7 +228,7 @@ private function modelFor(string $class, string $type, string $ipAddress)
210228 return new $ class ($ record , $ this ->locales );
211229 }
212230
213- private function flatModelFor (string $ class , string $ type , string $ ipAddress )
231+ private function flatModelFor (string $ class , string $ type , string $ ipAddress ): AbstractModel
214232 {
215233 list ($ record , $ prefixLen ) = $ this ->getRecord ($ class , $ type , $ ipAddress );
216234
0 commit comments