diff --git a/GeoIP2.php b/GeoIP2.php index 77e5376..26fba52 100644 --- a/GeoIP2.php +++ b/GeoIP2.php @@ -13,15 +13,15 @@ namespace Geocoder\Provider\GeoIP2; use Geocoder\Collection; +use Geocoder\Exception\InvalidCredentials; +use Geocoder\Exception\QuotaExceeded; +use Geocoder\Exception\UnsupportedOperation; use Geocoder\Model\Address; use Geocoder\Model\AddressCollection; -use Geocoder\Query\GeocodeQuery; -use Geocoder\Query\ReverseQuery; use Geocoder\Provider\AbstractProvider; use Geocoder\Provider\Provider; -use Geocoder\Exception\UnsupportedOperation; -use Geocoder\Exception\InvalidCredentials; -use Geocoder\Exception\QuotaExceeded; +use Geocoder\Query\GeocodeQuery; +use Geocoder\Query\ReverseQuery; use GeoIp2\Exception\AddressNotFoundException; use GeoIp2\Exception\AuthenticationException; use GeoIp2\Exception\OutOfQueriesException; @@ -41,9 +41,6 @@ public function __construct(GeoIP2Adapter $adapter) $this->adapter = $adapter; } - /** - * {@inheritdoc} - */ public function geocodeQuery(GeocodeQuery $query): Collection { $address = $query->getText(); @@ -89,25 +86,16 @@ public function geocodeQuery(GeocodeQuery $query): Collection ]); } - /** - * {@inheritdoc} - */ public function reverseQuery(ReverseQuery $query): Collection { throw new UnsupportedOperation('The GeoIP2 provider is not able to do reverse geocoding.'); } - /** - * {@inheritdoc} - */ public function getName(): string { return 'geoip2'; } - /** - * @param string $address - */ private function executeQuery(string $address): string { $uri = sprintf('file://geoip?%s', $address); diff --git a/GeoIP2Adapter.php b/GeoIP2Adapter.php index a1b246e..00b06d4 100644 --- a/GeoIP2Adapter.php +++ b/GeoIP2Adapter.php @@ -12,9 +12,9 @@ namespace Geocoder\Provider\GeoIP2; -use GeoIp2\ProviderInterface; use Geocoder\Exception\InvalidArgument; use Geocoder\Exception\UnsupportedOperation; +use GeoIp2\ProviderInterface; /** * @author Jens Wiese @@ -24,9 +24,9 @@ class GeoIP2Adapter /** * GeoIP2 models (e.g. city or country). */ - const GEOIP2_MODEL_CITY = 'city'; + public const GEOIP2_MODEL_CITY = 'city'; - const GEOIP2_MODEL_COUNTRY = 'country'; + public const GEOIP2_MODEL_COUNTRY = 'country'; /** * @var ProviderInterface @@ -39,8 +39,7 @@ class GeoIP2Adapter protected $geoIP2Model; /** - * @param \GeoIp2\ProviderInterface $geoIpProvider - * @param string $geoIP2Model (e.g. self::GEOIP2_MODEL_CITY) + * @param string $geoIP2Model (e.g. self::GEOIP2_MODEL_CITY) */ public function __construct(ProviderInterface $geoIpProvider, $geoIP2Model = self::GEOIP2_MODEL_CITY) { @@ -57,8 +56,6 @@ public function __construct(ProviderInterface $geoIpProvider, $geoIP2Model = sel * Returns the content fetched from a given resource. * * @param string $url (e.g. file://database?127.0.0.1) - * - * @return string */ public function getContent(string $url): string { @@ -81,8 +78,6 @@ public function getContent(string $url): string /** * Returns the name of the Adapter. - * - * @return string */ public function getName(): string { @@ -91,10 +86,6 @@ public function getName(): string /** * Returns whether method is supported by GeoIP2. - * - * @param string $method - * - * @return bool */ protected function isSupportedGeoIP2Model(string $method): bool { diff --git a/Tests/GeoIP2AdapterTest.php b/Tests/GeoIP2AdapterTest.php index a15f850..f1ca60a 100644 --- a/Tests/GeoIP2AdapterTest.php +++ b/Tests/GeoIP2AdapterTest.php @@ -13,7 +13,6 @@ namespace Geocoder\Provider\GeoIP2\Tests; use Geocoder\Provider\GeoIP2\GeoIP2Adapter; -use RuntimeException; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -28,14 +27,12 @@ class GeoIP2AdapterTest extends TestCase protected $adapter; /** - * {@inheritdoc} - * - * @throws RuntimeException + * @throws \RuntimeException */ public static function setUpBeforeClass(): void { if (false === class_exists('\GeoIp2\Database\Reader')) { - throw new RuntimeException("The maxmind's lib 'geoip2/geoip2' is required to run this test."); + throw new \RuntimeException("The maxmind's lib 'geoip2/geoip2' is required to run this test."); } } diff --git a/Tests/GeoIP2Test.php b/Tests/GeoIP2Test.php index aee4203..a96796f 100644 --- a/Tests/GeoIP2Test.php +++ b/Tests/GeoIP2Test.php @@ -13,17 +13,17 @@ namespace Geocoder\Provider\GeoIP2\Tests; use Geocoder\Collection; +use Geocoder\Exception\InvalidCredentials; +use Geocoder\Exception\QuotaExceeded; use Geocoder\IntegrationTest\BaseTestCase; use Geocoder\Location; -use Geocoder\Query\GeocodeQuery; -use Geocoder\Query\ReverseQuery; use Geocoder\Provider\GeoIP2\GeoIP2; use Geocoder\Provider\GeoIP2\GeoIP2Adapter; +use Geocoder\Query\GeocodeQuery; +use Geocoder\Query\ReverseQuery; use GeoIp2\Database\Reader; use GeoIp2\Exception\AuthenticationException; use GeoIp2\Exception\OutOfQueriesException; -use Geocoder\Exception\InvalidCredentials; -use Geocoder\Exception\QuotaExceeded; use PHPUnit\Framework\MockObject\MockObject; /** @@ -164,8 +164,6 @@ public static function provideDataForRetrievingGeodata() * @dataProvider provideDataForRetrievingGeodata * * @param string $address - * @param mixed $adapterResponse - * @param mixed $expectedGeodata */ public function testRetrievingGeodata($address, $adapterResponse, $expectedGeodata) { @@ -235,9 +233,6 @@ public function testGeoIp2Encoding() /** * @dataProvider provideDataForTestingExceptions - * - * @param \Exception $original - * @param string $replacementClass */ public function testExceptionConversion(\Exception $original, string $replacementClass) { @@ -260,8 +255,6 @@ public static function provideDataForTestingExceptions(): array } /** - * @param mixed $returnValue - * * @return GeoIP2Adapter&MockObject */ private function getGeoIP2AdapterMock($returnValue = '')