public static function parseHost($input, $isSpecial)
    {
        $inputString = (string)$input;
        if ($inputString !== '' && $inputString[0] === '[') {
            $result = substr($inputString, -1) !== ']' ? false : self::parseIPv6(substr($inputString, 1, -1));
        } elseif (!$isSpecial) {
            $result = static::parseOpaqueHost($input);
        } else {
            $domain = Infrastructure::percentDecode($input);
            $asciiDomain = self::domainToASCII($domain);
            $result = $asciiDomain === false || preg_match(static::FORBIDDEN_HOST_CODE_POINTS, $asciiDomain) !== 0
                ? false
                : self::parseIPv4($asciiDomain);
        }
        return $result;
    }
public static function parseHost($input, $isSpecial)
    {
        $inputString = (string)$input;
        if ($inputString !== '' && $inputString[0] === '[') {
            $result = substr($inputString, -1) !== ']' ? false : self::parseIPv6(substr($inputString, 1, -1));
        } elseif (!$isSpecial) {
            $result = static::parseOpaqueHost($input);
        } else {
            $domain = Infrastructure::percentDecode($input);
            $asciiDomain = self::domainToASCII($domain);
            $result = $asciiDomain === false || preg_match(static::FORBIDDEN_HOST_CODE_POINTS, $asciiDomain) !== 0
                ? false
                : self::parseIPv4($asciiDomain);
        }
        return $result;
    }
public static function parseHost ( $ input , $ isSpecial ) { $ inputString = ( string ) $ input ; if ( $ inputString !== '' && $ inputString [ 0 ] === '[' ) { $ result = substr ( $ inputString , - 1 ) !== ']' ? false : self :: parseIPv6 ( substr ( $ inputString , 1 , - 1 ) ) ; } elseif ( ! $ isSpecial ) { $ result = static :: parseOpaqueHost ( $ input ) ; } else { $ domain = Infrastructure :: percentDecode ( $ input ) ; $ asciiDomain = self :: domainToASCII ( $ domain ) ; $ result = $ asciiDomain === false || preg_match ( static :: FORBIDDEN_HOST_CODE_POINTS , $ asciiDomain ) !== 0 ? false : self :: parseIPv4 ( $ asciiDomain ) ; } return $ result ; }
The host parser.
@see \esperecyan\url\lib\HostProcessing::domainToUnicode()
@see \esperecyan\url\lib\URL::isSpecial()
@link https://url.spec.whatwg.org/#concept-host-parser URL Standard
@param string $input A UTF-8 string.
@param bool $isSpecial
@return string|int|float|int[]
If host is IPv4 address, returns a 32-bit unsigned integer (an integer or float).
If host is IPv6 address, returns an array of a 16-bit unsigned integer.
The host parser .