mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Moved Ip resolvers to the Resolver subnamespace
This commit is contained in:
parent
30314fd532
commit
3520ab6b18
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 [
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -1,9 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\IpGeolocation;
|
||||
namespace Shlinkio\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
||||
|
||||
class ChainIpLocationResolver implements IpLocationResolverInterface
|
||||
{
|
@ -1,9 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\IpGeolocation;
|
||||
namespace Shlinkio\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
||||
|
||||
class EmptyIpLocationResolver implements IpLocationResolverInterface
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\IpGeolocation;
|
||||
namespace Shlinkio\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use GeoIp2\Database\Reader;
|
||||
use GeoIp2\Exception\AddressNotFoundException;
|
||||
@ -9,6 +9,8 @@ use GeoIp2\Model\City;
|
||||
use GeoIp2\Record\Subdivision;
|
||||
use MaxMind\Db\Reader\InvalidDatabaseException;
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
||||
|
||||
use function Functional\first;
|
||||
|
@ -1,12 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\IpGeolocation;
|
||||
namespace Shlinkio\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
||||
|
||||
use function Shlinkio\Shlink\Common\json_decode;
|
||||
use function sprintf;
|
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\IpGeolocation;
|
||||
namespace Shlinkio\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model;
|
||||
|
||||
interface IpLocationResolverInterface
|
||||
{
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation;
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Prophecy\ObjectProphecy;
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\ChainIpLocationResolver;
|
||||
use Shlinkio\Shlink\IpGeolocation\IpLocationResolverInterface;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\ChainIpLocationResolver;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
||||
|
||||
class ChainIpLocationResolverTest extends TestCase
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation;
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
||||
use Shlinkio\Shlink\IpGeolocation\EmptyIpLocationResolver;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\EmptyIpLocationResolver;
|
||||
|
||||
use function Functional\map;
|
||||
use function range;
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation;
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use GeoIp2\Database\Reader;
|
||||
use GeoIp2\Exception\AddressNotFoundException;
|
||||
@ -10,8 +10,8 @@ use MaxMind\Db\Reader\InvalidDatabaseException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Prophecy\ObjectProphecy;
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\GeoLite2LocationResolver;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\GeoLite2LocationResolver;
|
||||
|
||||
class GeoLite2LocationResolverTest extends TestCase
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation;
|
||||
namespace ShlinkioTest\Shlink\IpGeolocation\Resolver;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
@ -9,8 +9,8 @@ use GuzzleHttp\Psr7\Response;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Prophecy\ObjectProphecy;
|
||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||
use Shlinkio\Shlink\IpGeolocation\IpApiLocationResolver;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
use Shlinkio\Shlink\IpGeolocation\Resolver\IpApiLocationResolver;
|
||||
|
||||
use function json_encode;
|
||||
|
Loading…
Reference in New Issue
Block a user