private function parseConfiguredServers(array $servers): Collection
    {
        $result = new Collection();

        foreach ($servers as $server) {
            if (is_array($server)) {
                if (!empty(array_except($server, ['host', 'port', 'timeout']))) {
                    throw new InvalidConfigurationException('Servers in array notation may only contain a host, port and timeout parameter.');
                }
                if (!array_has($server, 'host')) {
                    throw new InvalidConfigurationException('For servers in array notation, the host parameter is required.');
                }

                $host = Arr::get($server, 'host');
                $port = Arr::get($server, 'port');
                $timeout = Arr::get($server, 'timeout', self::DEFAULT_TIMEOUT);

                $result->push(new Server($host, $port, $timeout));
            } else if (is_string($server)) {
                $result->push(new Server($server, null, self::DEFAULT_TIMEOUT));
            } else {
                throw new InvalidConfigurationException('The server configuration may only contain arrays or strings.');
            }
        }

        return $result;
    }
private function parseConfiguredServers(array $servers): Collection
    {
        $result = new Collection();

        foreach ($servers as $server) {
            if (is_array($server)) {
                if (!empty(array_except($server, ['host', 'port', 'timeout']))) {
                    throw new InvalidConfigurationException('Servers in array notation may only contain a host, port and timeout parameter.');
                }
                if (!array_has($server, 'host')) {
                    throw new InvalidConfigurationException('For servers in array notation, the host parameter is required.');
                }

                $host = Arr::get($server, 'host');
                $port = Arr::get($server, 'port');
                $timeout = Arr::get($server, 'timeout', self::DEFAULT_TIMEOUT);

                $result->push(new Server($host, $port, $timeout));
            } else if (is_string($server)) {
                $result->push(new Server($server, null, self::DEFAULT_TIMEOUT));
            } else {
                throw new InvalidConfigurationException('The server configuration may only contain arrays or strings.');
            }
        }

        return $result;
    }
private function parseConfiguredServers ( array $ servers ) : Collection { $ result = new Collection ( ) ; foreach ( $ servers as $ server ) { if ( is_array ( $ server ) ) { if ( ! empty ( array_except ( $ server , [ 'host' , 'port' , 'timeout' ] ) ) ) { throw new InvalidConfigurationException ( 'Servers in array notation may only contain a host, port and timeout parameter.' ) ; } if ( ! array_has ( $ server , 'host' ) ) { throw new InvalidConfigurationException ( 'For servers in array notation, the host parameter is required.' ) ; } $ host = Arr :: get ( $ server , 'host' ) ; $ port = Arr :: get ( $ server , 'port' ) ; $ timeout = Arr :: get ( $ server , 'timeout' , self :: DEFAULT_TIMEOUT ) ; $ result -> push ( new Server ( $ host , $ port , $ timeout ) ) ; } else if ( is_string ( $ server ) ) { $ result -> push ( new Server ( $ server , null , self :: DEFAULT_TIMEOUT ) ) ; } else { throw new InvalidConfigurationException ( 'The server configuration may only contain arrays or strings.' ) ; } } return $ result ; }
Parses an array of servers which can be given in different formats.
Unifies the format for the resulting collection.

@param array $servers
@return Collection
@throws InvalidConfigurationException
Parses an array of servers which can be given in different formats . Unifies the format for the resulting collection .