1717
1818namespace MongoDB ;
1919
20+ use MongoDB \Driver \Exception \InvalidArgumentException as DriverInvalidArgumentException ;
21+ use MongoDB \Driver \Exception \RuntimeException as DriverRuntimeException ;
2022use MongoDB \Driver \Manager ;
2123use MongoDB \Driver \ReadConcern ;
2224use MongoDB \Driver \ReadPreference ;
2325use MongoDB \Driver \Session ;
2426use MongoDB \Driver \WriteConcern ;
25- use MongoDB \Driver \Exception \RuntimeException as DriverRuntimeException ;
26- use MongoDB \Driver \Exception \InvalidArgumentException as DriverInvalidArgumentException ;
2727use MongoDB \Exception \InvalidArgumentException ;
2828use MongoDB \Exception \UnexpectedValueException ;
2929use MongoDB \Exception \UnsupportedException ;
30+ use MongoDB \Model \BSONArray ;
31+ use MongoDB \Model \BSONDocument ;
3032use MongoDB \Model \DatabaseInfoIterator ;
3133use MongoDB \Operation \DropDatabase ;
3234use MongoDB \Operation \ListDatabases ;
3335use MongoDB \Operation \Watch ;
36+ use function is_array ;
3437
3538class Client
3639{
3740 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,
4144 ];
4245 private static $ wireVersionForReadConcern = 4 ;
4346 private static $ wireVersionForWritableCommandWriteConcern = 5 ;
@@ -147,13 +150,13 @@ public function __toString()
147150 */
148151 public function dropDatabase ($ databaseName , array $ options = [])
149152 {
150- if ( ! isset ($ options ['typeMap ' ])) {
153+ if (! isset ($ options ['typeMap ' ])) {
151154 $ options ['typeMap ' ] = $ this ->typeMap ;
152155 }
153156
154157 $ server = $ this ->manager ->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
155158
156- if ( ! isset ($ options ['writeConcern ' ]) && \ MongoDB \ server_supports_feature ($ server , self ::$ wireVersionForWritableCommandWriteConcern )) {
159+ if (! isset ($ options ['writeConcern ' ]) && server_supports_feature ($ server , self ::$ wireVersionForWritableCommandWriteConcern )) {
157160 $ options ['writeConcern ' ] = $ this ->writeConcern ;
158161 }
159162
@@ -269,7 +272,7 @@ public function selectDatabase($databaseName, array $options = [])
269272 * Start a new client session.
270273 *
271274 * @see http://php.net/manual/en/mongodb-driver-manager.startsession.php
272- * @param array $options Session options
275+ * @param array $options Session options
273276 * @return Session
274277 */
275278 public function startSession (array $ options = [])
@@ -288,17 +291,17 @@ public function startSession(array $options = [])
288291 */
289292 public function watch (array $ pipeline = [], array $ options = [])
290293 {
291- if ( ! isset ($ options ['readPreference ' ])) {
294+ if (! isset ($ options ['readPreference ' ])) {
292295 $ options ['readPreference ' ] = $ this ->readPreference ;
293296 }
294297
295298 $ server = $ this ->manager ->selectServer ($ options ['readPreference ' ]);
296299
297- if ( ! isset ($ options ['readConcern ' ]) && \ MongoDB \ server_supports_feature ($ server , self ::$ wireVersionForReadConcern )) {
300+ if (! isset ($ options ['readConcern ' ]) && server_supports_feature ($ server , self ::$ wireVersionForReadConcern )) {
298301 $ options ['readConcern ' ] = $ this ->readConcern ;
299302 }
300303
301- if ( ! isset ($ options ['typeMap ' ])) {
304+ if (! isset ($ options ['typeMap ' ])) {
302305 $ options ['typeMap ' ] = $ this ->typeMap ;
303306 }
304307
0 commit comments