Moved logic to create a visitor from a request to the visitor itself

This commit is contained in:
Alejandro Celaya
2018-10-18 20:24:25 +02:00
parent 545094cddf
commit 44f0011445
5 changed files with 18 additions and 11 deletions

View File

@@ -5,14 +5,13 @@ namespace Shlinkio\Shlink\Common\Middleware;
use Interop\Container\ContainerInterface;
use RKA\Middleware\IpAddress;
use Shlinkio\Shlink\Core\Model\Visitor;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\ServiceManager\Factory\FactoryInterface;
class IpAddressMiddlewareFactory implements FactoryInterface
{
public const REMOTE_ADDRESS = 'remote_address';
/**
* Create an object
*
@@ -24,6 +23,6 @@ class IpAddressMiddlewareFactory implements FactoryInterface
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null): IpAddress
{
return new IpAddress(true, [], self::REMOTE_ADDRESS);
return new IpAddress(true, [], Visitor::REMOTE_ADDRESS_ATTR);
}
}