diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index ee4c8952..f014bcb2 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -10,7 +10,7 @@ use Shlinkio\Shlink\Common\Doctrine\NoDbNameConnectionFactory; use Shlinkio\Shlink\Common\Service\PreviewGenerator; use Shlinkio\Shlink\Core\Service; use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdater; -use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console as SymfonyCli; use Symfony\Component\Lock\Factory as Locker; diff --git a/module/CLI/src/Command/Visit/LocateVisitsCommand.php b/module/CLI/src/Command/Visit/LocateVisitsCommand.php index d337d1fb..cbaf2118 100644 --- a/module/CLI/src/Command/Visit/LocateVisitsCommand.php +++ b/module/CLI/src/Command/Visit/LocateVisitsCommand.php @@ -15,8 +15,8 @@ use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; use Shlinkio\Shlink\Core\Service\VisitServiceInterface; -use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; diff --git a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php index 543c619d..0ce1a5bf 100644 --- a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php +++ b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php @@ -16,8 +16,8 @@ use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Service\VisitService; -use Shlinkio\Shlink\IpGeolocation\IpApiLocationResolver; use Shlinkio\Shlink\IpGeolocation\Model\Location; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpApiLocationResolver; use Symfony\Component\Console\Application; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; diff --git a/module/Core/config/event_dispatcher.config.php b/module/Core/config/event_dispatcher.config.php index c47114d2..a85ad6a2 100644 --- a/module/Core/config/event_dispatcher.config.php +++ b/module/Core/config/event_dispatcher.config.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdater; -use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory; return [ diff --git a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php index 528ccbf5..e0a0f274 100644 --- a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php +++ b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php @@ -10,8 +10,8 @@ use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; -use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use function sprintf; diff --git a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php index 4f76ca98..5c10406c 100644 --- a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php +++ b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php @@ -19,8 +19,8 @@ use Shlinkio\Shlink\Core\EventDispatcher\LocateShortUrlVisit; use Shlinkio\Shlink\Core\EventDispatcher\ShortUrlVisited; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Visit\Model\UnknownVisitLocation; -use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; +use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; class LocateShortUrlVisitTest extends TestCase { diff --git a/module/IpGeolocation/config/dependencies.config.php b/module/IpGeolocation/config/dependencies.config.php index a42bad67..51474dd4 100644 --- a/module/IpGeolocation/config/dependencies.config.php +++ b/module/IpGeolocation/config/dependencies.config.php @@ -13,26 +13,28 @@ return [ 'dependencies' => [ 'factories' => [ - IpApiLocationResolver::class => ConfigAbstractFactory::class, - GeoLite2LocationResolver::class => ConfigAbstractFactory::class, - EmptyIpLocationResolver::class => InvokableFactory::class, - ChainIpLocationResolver::class => ConfigAbstractFactory::class, + Resolver\IpApiLocationResolver::class => ConfigAbstractFactory::class, + Resolver\GeoLite2LocationResolver::class => ConfigAbstractFactory::class, + Resolver\EmptyIpLocationResolver::class => InvokableFactory::class, + Resolver\ChainIpLocationResolver::class => ConfigAbstractFactory::class, + GeoLite2\GeoLite2Options::class => ConfigAbstractFactory::class, GeoLite2\DbUpdater::class => ConfigAbstractFactory::class, ], 'aliases' => [ - IpLocationResolverInterface::class => ChainIpLocationResolver::class, + Resolver\IpLocationResolverInterface::class => Resolver\ChainIpLocationResolver::class, ], ], ConfigAbstractFactory::class => [ - IpApiLocationResolver::class => ['httpClient'], - GeoLite2LocationResolver::class => [Reader::class], - ChainIpLocationResolver::class => [ - GeoLite2LocationResolver::class, - IpApiLocationResolver::class, - EmptyIpLocationResolver::class, + Resolver\IpApiLocationResolver::class => [GuzzleClient::class], + Resolver\GeoLite2LocationResolver::class => [Reader::class], + Resolver\ChainIpLocationResolver::class => [ + Resolver\GeoLite2LocationResolver::class, + Resolver\IpApiLocationResolver::class, + Resolver\EmptyIpLocationResolver::class, ], + GeoLite2\GeoLite2Options::class => ['config.geolite2'], GeoLite2\DbUpdater::class => [ GuzzleClient::class, diff --git a/module/IpGeolocation/src/ChainIpLocationResolver.php b/module/IpGeolocation/src/Resolver/ChainIpLocationResolver.php similarity index 84% rename from module/IpGeolocation/src/ChainIpLocationResolver.php rename to module/IpGeolocation/src/Resolver/ChainIpLocationResolver.php index 2d837a7f..3b3b6b16 100644 --- a/module/IpGeolocation/src/ChainIpLocationResolver.php +++ b/module/IpGeolocation/src/Resolver/ChainIpLocationResolver.php @@ -1,9 +1,11 @@