Validates an ip address format

@param string $address

@return boolean True if it is a valid IP address, False if Not.
503633
public static function isIP($address)
    {

        //Split the IP address of the form  into parts
        $parts = explode('.', $address);
        //=4 parts
        if (sizeof($parts) != 4) {
            return false;
        }
        foreach ($parts as $part):
            if (empty($part) || !static::number($part) || $part > 255) {
                return false;
            }
        endforeach;

        return true;
    }
249448
public function checkAddress($address)
    {
        $addr = $this->decodeBase58($address);
        if (strlen($addr) != 50) {
            return false;
        }
        $check = substr($addr, 0, strlen($addr) - 8);
        $check = pack('H*', $check);
        $check = strtoupper(hash('sha256', hash('sha256', $check, true)));
        $check = substr($check, 0, 8);

        return $check == substr($addr, strlen($addr) - 8);
    }
183309
public function setCryptoAddress($address)
    {
        if (!$this->checkAddress($address) || !preg_match(static::CRYPTO_ADDRESS_VALIDATION_REGEX, $address)) {
            throw new ErrorParameter('Invalid crypto address provided');
        }

        $this->crypto_address = $address;

        return $this;
    }
971298
public static function validateIpAddress($ipAddress) {
        if (strtolower($ipAddress) === 'unknown') {
            return false;
        }

        // generate ipv4 network address
        $ipAddress = ip2long($ipAddress);

        // if the ip is set and not equivalent to 255.255.255.255
        if ($ipAddress !== false && $ipAddress !== -1) {
            // make sure to get unsigned long representation of ip
            // due to discrepancies between 32 and 64 bit OSes and
            // signed numbers (ints default to signed in PHP)
            $ipAddress = sprintf('%u', $ipAddress);
            // do private network range checking
            if ($ipAddress >= 0 && $ipAddress <= 50331647) {
                return false;
            }
            if ($ipAddress >= 167772160 && $ipAddress <= 184549375) {
                return false;
            }
            if ($ipAddress >= 2130706432 && $ipAddress <= 2147483647) {
                return false;
            }
            if ($ipAddress >= 2851995648 && $ipAddress <= 2852061183) {
                return false;
            }
            if ($ipAddress >= 2886729728 && $ipAddress <= 2887778303) {
                return false;
            }
            if ($ipAddress >= 3221225984 && $ipAddress <= 3221226239) {
                return false;
            }
            if ($ipAddress >= 3232235520 && $ipAddress <= 3232301055) {
                return false;
            }
            if ($ipAddress >= 4294967040) {
                return false;
            }
        }
        return true;
    }
1182492
public function isValidIP4(string $ipAddress): bool
    {
        return (bool) filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE);
    }
1296085
public function contains($address)
    {
        $ob = new Horde_Mail_Rfc822_Address($address);

        foreach ($this->raw_addresses as $val) {
            if ($val->match($ob)) {
                return true;
            }
        }

        return false;
    }
823020
private static boolean isIPAdressValid(final String ip){

        // InetAddress.getByName() validates 'null' as a valid IP (localhost).
        // we do not want that
        if (hasValue(ip)) {
            return IP_ADDR_PATTERN.matcher(ip).matches();
        }
        return false;
    }
319171
public static function validate_ip($ip = '')
    {

        if (empty($ip)) return false;

        return (ip2long($ip) !== false) ? true : false;
    }
281189
public function validateIP($ipAddress = null)
    {
        if ($ipAddress === null) {
            $parsed = parse_url($this->uri);
            $ipAddress = isset($parsed['host']) ? $parsed['host'] : null;
        }
        return (
            filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ||
            filter_var(trim($ipAddress, '[]'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
        );
    }
1011048
public function at($address)
    {
        if (AddressValidator::validate($address) === false) {
            throw new InvalidArgumentException('Please make sure address is valid.');
        }
        $this->toAddress = AddressFormatter::format($address);

        return $this;
    }
668574
public function isValid($value) {
		$intIp = ip2long($value);
		
		if ($intIp !== false && long2ip($intIp) === $value) {
			return true;
		}
		
		$this->addMessage('Invalid IP address');
		
		return false;
	}
513300
protected function _isGroup($address)
    {
        // First comma not in quotes, angles or escaped:
        $parts  = explode(',', $address);
        $string = $this->_splitCheck($parts, ',');

        // Now we have the first address, we can reliably check for a
        // group by searching for a colon that's not escaped or in
        // quotes or angle brackets.
        if (count($parts = explode(':', $string)) > 1) {
            $string2 = $this->_splitCheck($parts, ':');
            return ($string2 !== $string);
        } else {
            return false;
        }
    }
280818
private function checkIfAddressExists($address)
    {
        $oldAddress = $this->addressRepository->findOneByEmailIgnoreHidden( $address );

        return isset($oldAddress) && $oldAddress ? $oldAddress : null;
    }
347022
public static function validateIp($ip)
    {
        if (strtolower($ip) === 'unknown') {
            return false;
        }
        // generate ipv4 network address
        $ip = ip2long($ip);

        // if the ip is set and not equivalent to 255.255.255.255
        if (($ip !== false) && ($ip !== -1)) {
            // make sure to get unsigned long representation of ip
            // due to discrepancies between 32 and 64 bit OSes and
            // signed numbers (ints default to signed in PHP)
            $ip = sprintf('%u', $ip);
            // do private network range checking
            if ($ip >= 0 && $ip <= 50331647) {
                return false;
            }
            if ($ip >= 167772160 && $ip <= 184549375) {
                return false;
            }
            if ($ip >= 2130706432 && $ip <= 2147483647) {
                return false;
            }
            if ($ip >= 2851995648 && $ip <= 2852061183) {
                return false;
            }
            if ($ip >= 2886729728 && $ip <= 2887778303) {
                return false;
            }
            if ($ip >= 3221225984 && $ip <= 3221226239) {
                return false;
            }
            if ($ip >= 3232235520 && $ip <= 3232301055) {
                return false;
            }
            if ($ip >= 4294967040) {
                return false;
            }
        }
        return true;
    }
1263522
private function canUserDeleteShippingAddress($address)
    {
        $canDelete = false;
        $user = $this->getUser();
        if ($address->oxaddress__oxuserid->value === $user->getId()) {
            $canDelete = true;
        }

        return $canDelete;
    }
264595
public function setAddress(string $address = null) : void
    {
        if (!is_null($address) && !filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {
            Utils::getContainer()->getLogger()->warning(sprintf('Provided argument (%s) is not a valid IP address.', $address));
        }
        $this->Address = $address;
    }
165560
def validateaddress(self, address: str) -> bool:
        ""

        try:
            Address.from_string(address, self.network_properties)
        except InvalidAddress:
            return False

        return True