Is ip.

@param string $value
@return bool
437197
public static function ip(string $value): bool
    {
        $result = filter_var($value, FILTER_VALIDATE_IP);
        return is_string($result) && $value === $result;
    }
755662
public static function isUri($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        // http://tools.ietf.org/html/rfc3986
        //
        // URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
        // hier-part   = "//" authority path-abempty
        //             / path-absolute
        //             / path-rootless
        //             / path-empty
        $pattern = sprintf(
            '/\A%s%s%s%s%s\z/',
            '(?:([^:\/?#]+)(:))?',
            '(?:(\/\/)([^\/?#]*))?',
            '([^?#]*)',
            '(?:(\?)([^#]*))?',
            '(?:(#)(.*))?'
        );

        preg_match($pattern, (string) $value, $matches);
        $uri = self::uriComponentsFromMatches($matches);

        return self::isValidUri($uri);
    }
346568
public function validateValue($value)
    {
        list($domain, $ip) = explode('/', $value, 2);
        if (($error = (new DomainValidator())->validateValue($domain)) !== null) {
            return $error;
        }
        if ($ip !== null && ($error = (new IpValidator())->validateValue($ip)) !== null) {
            return $error;
        }

        return null;
    }
575846
public static function isIpAddress($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        return filter_var((string) $value, FILTER_VALIDATE_IP) !== false;
    }
38559
public function isValueValid($value) {
		return $value instanceof Type\Place || $value instanceof Type\PostalAddress || $value instanceof DataType\URLType;
	}
1012317
public static function isIp($ip)
    {
        $segments = explode('.', $ip);

        if (count($segments) === 4) {
            foreach ($segments as $segment) {
                if (!is_numeric($segment)) {
                    return false;
                }
            }

            return true;
        } else {
            return false;
        }
    }
1015697
private function isLocalIp ()
    {
        $ip = $this->serverData["REMOTE_ADDR"];

        if (!is_string($ip))
        {
            return false;
        }

        if (in_array($ip, ['127.0.0.1', 'fe80::1', '::1'], true))
        {
            return true;
        }

        // allowed (= local) IPs include
        // 10.0.0.0 – 10.255.255.255
        // 172.16.0.0 – 172.31.255.255
        // 192.168.0.0 – 192.168.255.255
        return 1 === preg_match("/^(10\\.|192\\.168\\.|172\\.(1[6-9]|2[0-9]|3[0-1])\\.)/", $ip);
    }
347483
public static function isIp($input = false) {

        if ($input && !filter_var($input, FILTER_VALIDATE_IP) === false) {

            return true;
        }

        return false;
    }
340823
private function detectFromServer($value)
    {
        $result = null;
        if (is_string($value) && preg_match('/\bnginx\/(\d+(\.\d+)+)/i', $value, $m)) {
            $result = $m[1];
        }

        return $result;
    }
1267084
public static function isIpV6Address($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        return filter_var((string) $value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false;
    }
904919
public static function validateUrl($value)
    {
        if (($url = parse_url($value)) && ! empty($url['scheme']) && ! empty($url['host'])) {
            return true;
        }
        return false;
    }
610735
private function isInt(string $value): bool
    {
        return \is_numeric($value) && (float)\round($value, 0) === (float)$value;
    }
871316
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        // Check input against IP address schema
        if ($this->_ipValidator->setTranslator($this->getTranslator())->isValid($valueString)) {
            if (!($this->_allow & self::ALLOW_IP)) {
                $this->_error(self::IP_ADDRESS_NOT_ALLOWED);
                return false;
            } else{
                return true;
            }
        }

        // Check input against DNS hostname schema
        $domainParts = explode('.', $valueString);
        if ((count($domainParts) > 1) && (strlen($valueString) >= 4) && (strlen($valueString) <= 254)) {
            $status = false;

            do {
                // First check TLD
                if (preg_match('/([a-z]{2,10})$/i', end($domainParts), $matches)) {

                    reset($domainParts);

                    // Hostname characters are: *(label dot)(label dot label); max 254 chars
                    // label: id-prefix [*ldh{61} id-prefix]; max 63 chars
                    // id-prefix: alpha / digit
                    // ldh: alpha / digit / dash

                    // Match TLD against known list
                    $this->_tld = strtolower($matches[1]);
                    if ($this->_validateTld) {
                        if (!in_array($this->_tld, $this->_validTlds)) {
                            $this->_error(self::UNKNOWN_TLD);
                            $status = false;
                            break;
                        }
                    }

                    /**
                     * Match against IDN hostnames
                     *
                     * @see Zend_Validate_Hostname_Interface
                     */
                    $labelChars = 'a-z0-9';
                    $utf8 = false;
                    $classFile = 'Zend/Validate/Hostname/' . ucfirst($this->_tld) . '.php';
                    if ($this->_validateIdn) {
                        if (Zend_Loader::isReadable($classFile)) {

                            // Load additional characters
                            $className = 'Zend_Validate_Hostname_' . ucfirst($this->_tld);
                            Zend_Loader::loadClass($className);
                            $labelChars .= call_user_func(array($className, 'getCharacters'));
                            $utf8 = true;
                        }
                    }

                    // Keep label regex short to avoid issues with long patterns when matching IDN hostnames
                    $regexLabel = '/^[' . $labelChars . '\x2d]{1,63}$/i';
                    if ($utf8) {
                        $regexLabel .= 'u';
                    }

                    // Check each hostname part
                    $valid = true;
                    foreach ($domainParts as $domainPart) {

                        // Check dash (-) does not start, end or appear in 3rd and 4th positions
                        if (strpos($domainPart, '-') === 0 
                            || (strlen($domainPart) > 2 && strpos($domainPart, '-', 2) == 2 && strpos($domainPart, '-', 3) == 3) 
                            || strrpos($domainPart, '-') === strlen($domainPart) - 1
                        ) {

                            $this->_error(self::INVALID_DASH);
                            $status = false;
                            break 2;
                        }

                        // Check each domain part
                        $status = @preg_match($regexLabel, $domainPart);
                        if ($status === false) {
                            /**
                             * Regex error
                             *
                             * @see Zend_Validate_Exception
                             */
                            include_once 'Zend/Validate/Exception.php';
                            throw new Zend_Validate_Exception('Internal error: DNS validation failed');
                        } elseif ($status === 0) {
                            $valid = false;
                        }
                    }

                    // If all labels didn't match, the hostname is invalid
                    if (!$valid) {
                        $this->_error(self::INVALID_HOSTNAME_SCHEMA);
                        $status = false;
                    }

                } else {
                    // Hostname not long enough
                    $this->_error(self::UNDECIPHERABLE_TLD);
                    $status = false;
                }
            } while (false);

            // If the input passes as an Internet domain name, and domain names are allowed, then the hostname
            // passes validation
            if ($status && ($this->_allow & self::ALLOW_DNS)) {
                return true;
            }
        } else {
            $this->_error(self::INVALID_HOSTNAME);
        }

        // Check input against local network name schema; last chance to pass validation
        $regexLocal = '/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}){1,254}$/';
        $status = @preg_match($regexLocal, $valueString);
        if (false === $status) {
            /**
             * Regex error
             *
             * @see Zend_Validate_Exception
             */
            include_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception('Internal error: local network name validation failed');
        }

        // If the input passes as a local network name, and local network names are allowed, then the
        // hostname passes validation
        $allowLocal = $this->_allow & self::ALLOW_LOCAL;
        if ($status && $allowLocal) {
            return true;
        }

        // If the input does not pass as a local network name, add a message
        if (!$status) {
            $this->_error(self::INVALID_LOCAL_NAME);
        }

        // If local network names are not allowed, add a message
        if ($status && !$allowLocal) {
            $this->_error(self::LOCAL_NAME_NOT_ALLOWED);
        }

        return false;
    }
126896
public function isValid($value)
    {
        $this->setValue($value);

        $pattern = '/^[a-z0-9_\-]*[a-z0-9]$/i';

        $this->pageNameOk = true;

        if (!preg_match($pattern, $value)) {
            $this->error(self::PAGE_NAME);
            $this->pageNameOk = false;
        }

        return $this->pageNameOk;
    }
179906
public static function IsInteger( $value ) : bool
   {

      return \is_int( $value ) || (bool) \preg_match( static::$rxInt32, (string) $value );

   }
1335174
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ((ip2long($valueString) === false) || (long2ip(ip2long($valueString)) !== $valueString)) {
            if (!function_exists('inet_pton')) {
                $this->_error();
                return false;
            } else if ((@inet_pton($value) === false) ||(inet_ntop(@inet_pton($value)) !== $valueString)) {
                $this->_error();
                return false;
            }
        }

        return true;
    }
153355
public function isValid($value)
    {
        $result = (boolean) filter_var($value, FILTER_VALIDATE_URL);
        if (!$result) {
            $this->addMessage('url');
        }
        return $result;
    }