Airship\Engine\Security\AirBrake::getSubnet PHP Method

getSubnet() public method

Determine if the IP is an IPv4 or IPv6 address, then pass to the correct method for handling that specific type.
public getSubnet ( string $ip ) : string
$ip string
return string
    public function getSubnet(string $ip) : string
    {
        if (\preg_match('/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$/', $ip)) {
            return $this->getIPv4Subnet($ip, (int) ($this->config['ipv4-subnet'] ?? 32));
        }
        return $this->getIPv6Subnet($ip, (int) ($this->config['ipv6-subnet'] ?? 128));
    }