1212
1313namespace Geocoder \Provider \IP2Location ;
1414
15+ use Geocoder \Collection ;
1516use Geocoder \Exception \InvalidCredentials ;
1617use Geocoder \Exception \UnsupportedOperation ;
17- use Geocoder \Collection ;
18+ use Geocoder \Http \ Provider \ AbstractHttpProvider ;
1819use Geocoder \Model \Address ;
1920use Geocoder \Model \AddressCollection ;
21+ use Geocoder \Provider \Provider ;
2022use Geocoder \Query \GeocodeQuery ;
2123use Geocoder \Query \ReverseQuery ;
22- use Geocoder \Http \Provider \AbstractHttpProvider ;
23- use Geocoder \Provider \Provider ;
2424use Psr \Http \Client \ClientInterface ;
2525
2626/**
@@ -31,7 +31,7 @@ final class IP2Location extends AbstractHttpProvider implements Provider
3131 /**
3232 * @var string
3333 */
34- const ENDPOINT_URL = 'https://api.ip2location.com/v2/?key=%s&ip=%s&format=json&package=WS9 ' ;
34+ public const ENDPOINT_URL = 'https://api.ip2location.com/v2/?key=%s&ip=%s&format=json&package=WS9 ' ;
3535
3636 /**
3737 * @var string
@@ -55,9 +55,6 @@ public function __construct(ClientInterface $client, string $apiKey)
5555 $ this ->endpointUrl = self ::ENDPOINT_URL ;
5656 }
5757
58- /**
59- * {@inheritdoc}
60- */
6158 public function geocodeQuery (GeocodeQuery $ query ): Collection
6259 {
6360 $ address = $ query ->getText ();
@@ -79,25 +76,16 @@ public function geocodeQuery(GeocodeQuery $query): Collection
7976 return $ this ->executeQuery ($ url );
8077 }
8178
82- /**
83- * {@inheritdoc}
84- */
8579 public function reverseQuery (ReverseQuery $ query ): Collection
8680 {
8781 throw new UnsupportedOperation ('The IP2Location provider is not able to do reverse geocoding. ' );
8882 }
8983
90- /**
91- * {@inheritdoc}
92- */
9384 public function getName (): string
9485 {
9586 return 'ip2location ' ;
9687 }
9788
98- /**
99- * @param string $url
100- */
10189 private function executeQuery (string $ url ): AddressCollection
10290 {
10391 $ content = $ this ->getUrlContents ($ url );
0 commit comments