src/Domain/Value/Identifier/Uri.php
protected static function encodeHost(string $host): string
    {
        // http://tools.ietf.org/html/rfc3986#section-3.2.2
        // IP-literal = "[" ( IPv6address / IPvFuture  ) "]"
        // IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
        if ($host[0] === '[') {
            $excluded = static::UNRESERVED_SET.static::SUB_DELIMS_SET.'\[\]:';

            return static::encode($host, $excluded);
        }

        // http://tools.ietf.org/html/rfc3986#section-3.2.2
        // NOTE: characters in IPv4 address are all in the unreserved set
        // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
        // reg-name    = *( unreserved / pct-encoded / sub-delims )
        $excluded = static::UNRESERVED_SET.static::SUB_DELIMS_SET;

        return static::encode($host, $excluded);
    }
protected static function encodeHost(string $host): string
    {
        // http://tools.ietf.org/html/rfc3986#section-3.2.2
        // IP-literal = "[" ( IPv6address / IPvFuture  ) "]"
        // IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
        if ($host[0] === '[') {
            $excluded = static::UNRESERVED_SET.static::SUB_DELIMS_SET.'\[\]:';

            return static::encode($host, $excluded);
        }

        // http://tools.ietf.org/html/rfc3986#section-3.2.2
        // NOTE: characters in IPv4 address are all in the unreserved set
        // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
        // reg-name    = *( unreserved / pct-encoded / sub-delims )
        $excluded = static::UNRESERVED_SET.static::SUB_DELIMS_SET;

        return static::encode($host, $excluded);
    }
protected static function encodeHost ( string $ host ) : string { // http://tools.ietf.org/html/rfc3986#section-3.2.2 // IP-literal = "[" ( IPv6address / IPvFuture  ) "]" // IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) if ( $ host [ 0 ] === '[' ) { $ excluded = static :: UNRESERVED_SET . static :: SUB_DELIMS_SET . '\[\]:' ; return static :: encode ( $ host , $ excluded ) ; } // http://tools.ietf.org/html/rfc3986#section-3.2.2 // NOTE: characters in IPv4 address are all in the unreserved set // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet // reg-name    = *( unreserved / pct-encoded / sub-delims ) $ excluded = static :: UNRESERVED_SET . static :: SUB_DELIMS_SET ; return static :: encode ( $ host , $ excluded ) ; }
Encodes the host

@param string $host The host

@return string
Encodes the host