protected function explodeAuthority($authority)
    {
        $reg_start      = '/^';
        $user_info_part = '(?:(?\'user_info\'.+)@)?';
        $host_part      = '(?\'host\'\[.+\]|.[^:]+)';
        $port_part      = '(?::(?\'port\'[0-9]+))?';
        $reg_end        = '/';

        $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end;

        preg_match($authority_syntax, $authority, $authority_parts);

        if (isset($authority_parts["port"])) {
            $authority_parts["port"] = (int) $authority_parts["port"];
        }

        return $authority_parts;
    }