Simplified IpAddressMiddlewareFactory and decoupled from Core module

This commit is contained in:
Alejandro Celaya
2019-08-11 10:22:19 +02:00
parent 5fa4fa0225
commit 0323e0d17d
8 changed files with 17 additions and 41 deletions

View File

@@ -4,11 +4,10 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Model;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Common\Middleware\IpAddressMiddlewareFactory;
final class Visitor
{
public const REMOTE_ADDRESS_ATTR = 'remote_address';
/** @var string */
private $userAgent;
/** @var string */
@@ -28,7 +27,7 @@ final class Visitor
return new self(
$request->getHeaderLine('User-Agent'),
$request->getHeaderLine('Referer'),
$request->getAttribute(self::REMOTE_ADDRESS_ATTR)
$request->getAttribute(IpAddressMiddlewareFactory::REQUEST_ATTR)
);
}