src/Security/RateLimiting/RateLimit.php
protected function getIp($config)
    {
        $remoteAddr = $_SERVER['REMOTE_ADDR'];
        if (filter_var($remoteAddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            $netmask = (isset($config["netmask_IPv4"]))
                ? $config["netmask_IPv4"] : self::DEFAULT_NETMASK_IPV4;
        } else {
            $netmask = (isset($config["netmask_IPv6"]))
                ? $config["netmask_IPv6"] : self::DEFAULT_NETMASK_IPV6;
        }

        $ipSubnet = $this->getSubnet($remoteAddr, $netmask);

        return $ipSubnet;
    }
protected function getIp($config)
    {
        $remoteAddr = $_SERVER['REMOTE_ADDR'];
        if (filter_var($remoteAddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            $netmask = (isset($config["netmask_IPv4"]))
                ? $config["netmask_IPv4"] : self::DEFAULT_NETMASK_IPV4;
        } else {
            $netmask = (isset($config["netmask_IPv6"]))
                ? $config["netmask_IPv6"] : self::DEFAULT_NETMASK_IPV6;
        }

        $ipSubnet = $this->getSubnet($remoteAddr, $netmask);

        return $ipSubnet;
    }
protected function getIp ( $ config ) { $ remoteAddr = $ _SERVER [ 'REMOTE_ADDR' ] ; if ( filter_var ( $ remoteAddr , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { $ netmask = ( isset ( $ config [ "netmask_IPv4" ] ) ) ? $ config [ "netmask_IPv4" ] : self :: DEFAULT_NETMASK_IPV4 ; } else { $ netmask = ( isset ( $ config [ "netmask_IPv6" ] ) ) ? $ config [ "netmask_IPv6" ] : self :: DEFAULT_NETMASK_IPV6 ; } $ ipSubnet = $ this -> getSubnet ( $ remoteAddr , $ netmask ) ; return $ ipSubnet ; }
Returns IP subnet string for the client

The net mask applied to the IP is used from the configuration supplied
to the method, if not present default net mask is used.

@param array $config Limit configuration
@return string IP subnet string
Returns IP subnet string for the client