This class offers a function to anonymize ip addresses.
Class IpAddressAnonymizer
package | LimeSurvey\Models\Services |
---|
__construct(string $ipAddress)
string
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.
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
isIpv4(): boolean
boolean
true if it is ipv4, false otherwise
isIpv6(): boolean
boolean
true if ipv6 is valid, false otherwise
isValidIp(): boolean
boolean
ipAddress :string
var | the original ip address |
---|
string