IpAddressAnonymizer

This class offers a function to anonymize ip addresses.

Class IpAddressAnonymizer

package

LimeSurvey\Models\Services

Methods

IpAddressAnonymizer constructor.

__construct(string $ipAddress)

Arguments

$ipAddress

string

Anonymizes ip address:

anonymizeIpAddress(): string|boolean

For instance, the IPv4 address 192.168.178.123 is anonymized to 192.168.178.0. The IPv6 address 2a03:2880:2117:df07:face:b00c:5:1 is anonymized to 2a03:2880:2117:0:0:0:0:0 It also checks before anonymizes if it has already been anonymized and in that case give back the ip address without changing it.

Response

string|boolean

if ip is not anonymized false will be returned (in case of not a valid ip or ip has already been anonymized), else the anonymize ip will be returned as a string

Checks if ip is a valid ipv4

isIpv4(): boolean

Response

boolean

true if it is ipv4, false otherwise

Checks if ip is a valid ipv6

isIpv6(): boolean

Response

boolean

true if ipv6 is valid, false otherwise

Checks if ip is a valid ipAddress

isValidIp(): boolean

Response

boolean

Properties

the original ip address

ipAddress :string
var

the original ip address

Type(s)

string