37 private $trustedProxies;
47 array $trustedProxies =
null 49 $this->request = $httpRequest;
51 $this->trustedProxies = $trustedProxies;
59 private function readAddress()
62 foreach ($this->alternativeHeaders as $var) {
63 if ($this->request->getServer($var,
false)) {
89 $ipList = array_filter(
91 function (
string $ip) {
92 return filter_var(trim($ip), FILTER_VALIDATE_IP);
95 if ($this->trustedProxies !==
null) {
96 $ipList = array_filter(
98 function (
string $ip) {
99 return !in_array(trim($ip), $this->trustedProxies,
true);
122 if ($this->remoteAddress !==
null) {
128 $this->remoteAddress =
false;
135 $this->remoteAddress =
false;
getRemoteAddress(bool $ipToLong=false)
__construct(RequestInterface $httpRequest, array $alternativeHeaders=[], array $trustedProxies=null)