protected function applyIpMask(string $ip, int $maskLength): string
    {
        if (empty($ip) || $maskLength === 0) {
            return $ip;
        }

        // IPv4 or mapped IPv4 in IPv6
        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            return $this->applyIpV4Mask($ip, $maskLength);
        }

        return $this->applyIpV6Mask($ip, $maskLength);
    }
protected function applyIpMask(string $ip, int $maskLength): string
    {
        if (empty($ip) || $maskLength === 0) {
            return $ip;
        }

        // IPv4 or mapped IPv4 in IPv6
        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            return $this->applyIpV4Mask($ip, $maskLength);
        }

        return $this->applyIpV6Mask($ip, $maskLength);
    }
protected function applyIpMask ( string $ ip , int $ maskLength ) : string { if ( empty ( $ ip ) || $ maskLength === 0 ) { return $ ip ; } // IPv4 or mapped IPv4 in IPv6 if ( filter_var ( $ ip , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { return $ this -> applyIpV4Mask ( $ ip , $ maskLength ) ; } return $ this -> applyIpV6Mask ( $ ip , $ maskLength ) ; }
Internal function to mask portions of the visitor IP address

@param string $ip IP address in network address format
@param int $maskLength Number of octets to reset
@return string
Internal function to mask portions of the visitor IP address