protected function createClient($dsn, array $config, array $options)
    {
        // By default driver options is an empty array.
        $driverOptions = [];

        if (isset($config['driver_options']) && is_array($config['driver_options'])) {
            $driverOptions = $config['driver_options'];
        }

        // Check if the credentials are not already set in the options
        if (!isset($options['username']) && !empty($config['username'])) {
            $options['username'] = $config['username'];
        }
        if (!isset($options['password']) && !empty($config['password'])) {
            $options['password'] = $config['password'];
        }

        return new Client($dsn, $options, $driverOptions);
    }
protected function createClient($dsn, array $config, array $options)
    {
        // By default driver options is an empty array.
        $driverOptions = [];

        if (isset($config['driver_options']) && is_array($config['driver_options'])) {
            $driverOptions = $config['driver_options'];
        }

        // Check if the credentials are not already set in the options
        if (!isset($options['username']) && !empty($config['username'])) {
            $options['username'] = $config['username'];
        }
        if (!isset($options['password']) && !empty($config['password'])) {
            $options['password'] = $config['password'];
        }

        return new Client($dsn, $options, $driverOptions);
    }
protected function createClient ( $ dsn , array $ config , array $ options ) { // By default driver options is an empty array. $ driverOptions = [ ] ; if ( isset ( $ config [ 'driver_options' ] ) && is_array ( $ config [ 'driver_options' ] ) ) { $ driverOptions = $ config [ 'driver_options' ] ; } // Check if the credentials are not already set in the options if ( ! isset ( $ options [ 'username' ] ) && ! empty ( $ config [ 'username' ] ) ) { $ options [ 'username' ] = $ config [ 'username' ] ; } if ( ! isset ( $ options [ 'password' ] ) && ! empty ( $ config [ 'password' ] ) ) { $ options [ 'password' ] = $ config [ 'password' ] ; } return new Client ( $ dsn , $ options , $ driverOptions ) ; }
Create a new MongoDB client connection.

@param  string $dsn
@param  array $config
@param  array $options
@return Client
Create a new MongoDB client connection .