17
17
18
18
namespace MongoDB ;
19
19
20
+ use MongoDB \Driver \Exception \InvalidArgumentException as DriverInvalidArgumentException ;
21
+ use MongoDB \Driver \Exception \RuntimeException as DriverRuntimeException ;
20
22
use MongoDB \Driver \Manager ;
21
23
use MongoDB \Driver \ReadConcern ;
22
24
use MongoDB \Driver \ReadPreference ;
23
25
use MongoDB \Driver \Session ;
24
26
use MongoDB \Driver \WriteConcern ;
25
- use MongoDB \Driver \Exception \RuntimeException as DriverRuntimeException ;
26
- use MongoDB \Driver \Exception \InvalidArgumentException as DriverInvalidArgumentException ;
27
27
use MongoDB \Exception \InvalidArgumentException ;
28
28
use MongoDB \Exception \UnexpectedValueException ;
29
29
use MongoDB \Exception \UnsupportedException ;
30
+ use MongoDB \Model \BSONArray ;
31
+ use MongoDB \Model \BSONDocument ;
30
32
use MongoDB \Model \DatabaseInfoIterator ;
31
33
use MongoDB \Operation \DropDatabase ;
32
34
use MongoDB \Operation \ListDatabases ;
33
35
use MongoDB \Operation \Watch ;
36
+ use function is_array ;
34
37
35
38
class Client
36
39
{
37
40
private static $ defaultTypeMap = [
38
- 'array ' => \ MongoDB \ Model \ BSONArray::class,
39
- 'document ' => \ MongoDB \ Model \ BSONDocument::class,
40
- 'root ' => \ MongoDB \ Model \ BSONDocument::class,
41
+ 'array ' => BSONArray::class,
42
+ 'document ' => BSONDocument::class,
43
+ 'root ' => BSONDocument::class,
41
44
];
42
45
private static $ wireVersionForReadConcern = 4 ;
43
46
private static $ wireVersionForWritableCommandWriteConcern = 5 ;
@@ -153,7 +156,7 @@ public function dropDatabase($databaseName, array $options = [])
153
156
154
157
$ server = $ this ->manager ->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
155
158
156
- if ( ! isset ($ options ['writeConcern ' ]) && \ MongoDB \ server_supports_feature ($ server , self ::$ wireVersionForWritableCommandWriteConcern )) {
159
+ if ( ! isset ($ options ['writeConcern ' ]) && server_supports_feature ($ server , self ::$ wireVersionForWritableCommandWriteConcern )) {
157
160
$ options ['writeConcern ' ] = $ this ->writeConcern ;
158
161
}
159
162
@@ -269,7 +272,7 @@ public function selectDatabase($databaseName, array $options = [])
269
272
* Start a new client session.
270
273
*
271
274
* @see http://php.net/manual/en/mongodb-driver-manager.startsession.php
272
- * @param array $options Session options
275
+ * @param array $options Session options
273
276
* @return Session
274
277
*/
275
278
public function startSession (array $ options = [])
@@ -294,7 +297,7 @@ public function watch(array $pipeline = [], array $options = [])
294
297
295
298
$ server = $ this ->manager ->selectServer ($ options ['readPreference ' ]);
296
299
297
- if ( ! isset ($ options ['readConcern ' ]) && \ MongoDB \ server_supports_feature ($ server , self ::$ wireVersionForReadConcern )) {
300
+ if ( ! isset ($ options ['readConcern ' ]) && server_supports_feature ($ server , self ::$ wireVersionForReadConcern )) {
298
301
$ options ['readConcern ' ] = $ this ->readConcern ;
299
302
}
300
303
0 commit comments