@@ -121,7 +121,7 @@ public function bulkWrite($requests, array $options = [])
121
121
sprintf (
122
122
'Option "writeConcern" is expected to be "%s", "%s" given. ' ,
123
123
WriteConcern::class,
124
- getType ($ options ['writeConcern ' ])
124
+ \ Tequila \ MongoDB \ getType ($ options ['writeConcern ' ])
125
125
)
126
126
);
127
127
}
@@ -145,7 +145,7 @@ public function bulkWrite($requests, array $options = [])
145
145
public function count (array $ filter = [], array $ options = [])
146
146
{
147
147
$ cursor = $ this ->executeCommand (
148
- ['count ' => $ this ->collectionName , 'query ' => (object )$ filter ],
148
+ ['count ' => $ this ->collectionName , 'query ' => (object ) $ filter ],
149
149
$ options
150
150
);
151
151
@@ -154,7 +154,7 @@ public function count(array $filter = [], array $options = [])
154
154
throw new UnexpectedResultException ('Command "count" did not return expected "n" field. ' );
155
155
}
156
156
157
- return (int )$ result ['n ' ];
157
+ return (int ) $ result ['n ' ];
158
158
}
159
159
160
160
/**
@@ -194,7 +194,7 @@ public function createIndexes(array $indexes, array $options = [])
194
194
$ options
195
195
);
196
196
197
- return array_map (function (Index $ index ) {
197
+ return array_map (function (Index $ index ) {
198
198
return $ index ->getName ();
199
199
}, $ indexes );
200
200
}
@@ -245,7 +245,7 @@ public function distinct($fieldName, array $filter = [], array $options = [])
245
245
246
246
$ command = ['distinct ' => $ this ->collectionName , 'key ' => $ fieldName ];
247
247
if ($ filter ) {
248
- $ command ['query ' ] = (object )$ filter ;
248
+ $ command ['query ' ] = (object ) $ filter ;
249
249
}
250
250
$ options ['typeMap ' ] = [];
251
251
@@ -269,8 +269,8 @@ public function drop(array $options = [])
269
269
{
270
270
try {
271
271
$ cursor = $ this ->executeCommand (['drop ' => $ this ->collectionName ], $ options );
272
- } catch (MongoDBRuntimeException $ e ) {
273
- if ('ns not found ' === $ e ->getMessage ()) {
272
+ } catch (MongoDBRuntimeException $ e ) {
273
+ if ('ns not found ' === $ e ->getMessage ()) {
274
274
return ['ok ' => 0 , 'errmsg ' => $ e ->getMessage ()];
275
275
}
276
276
@@ -387,20 +387,20 @@ public function findOneAndReplace(array $filter, $replacement, array $options =
387
387
throw new InvalidArgumentException (
388
388
sprintf (
389
389
'$replacement must be an array or an object, "%s" given. ' ,
390
- getType ($ replacement )
390
+ \ Tequila \ MongoDB \ getType ($ replacement )
391
391
)
392
392
);
393
393
}
394
394
395
395
try {
396
396
ensureValidDocument ($ replacement );
397
- } catch (InvalidArgumentException $ e ) {
397
+ } catch (InvalidArgumentException $ e ) {
398
398
throw new InvalidArgumentException (
399
399
sprintf ('Invalid $replacement document: %s ' , $ e ->getMessage ())
400
400
);
401
401
}
402
402
403
- $ options = ['update ' => (object )$ replacement ] + FindOneAndUpdateResolver::resolveStatic ($ options );
403
+ $ options = ['update ' => (object ) $ replacement ] + FindOneAndUpdateResolver::resolveStatic ($ options );
404
404
405
405
return $ this ->findAndModify ($ filter , $ options );
406
406
}
@@ -415,7 +415,7 @@ public function findOneAndUpdate(array $filter, array $update, array $options =
415
415
{
416
416
UpdateDocumentResolver::resolveStatic ($ update );
417
417
418
- $ options = ['update ' => (object )$ update ] + FindOneAndUpdateResolver::resolveStatic ($ options );
418
+ $ options = ['update ' => (object ) $ update ] + FindOneAndUpdateResolver::resolveStatic ($ options );
419
419
420
420
return $ this ->findAndModify ($ filter , $ options );
421
421
}
@@ -556,7 +556,7 @@ private function findAndModify(array $filter, array $options)
556
556
{
557
557
$ command = [
558
558
'findAndModify ' => $ this ->collectionName ,
559
- 'query ' => (object )$ filter ,
559
+ 'query ' => (object ) $ filter ,
560
560
];
561
561
562
562
$ options += ['typeMap ' => $ this ->typeMap ];
@@ -577,6 +577,9 @@ private function findAndModify(array $filter, array $options)
577
577
return \Tequila \MongoDB \applyTypeMap ($ result , $ typeMap );
578
578
}
579
579
580
+ /**
581
+ * @param array $options
582
+ */
580
583
private function resolveOptions (array $ options )
581
584
{
582
585
$ options += [
@@ -593,4 +596,4 @@ private function resolveOptions(array $options)
593
596
$ this ->writeConcern = $ options ['writeConcern ' ];
594
597
$ this ->typeMap = $ options ['typeMap ' ];
595
598
}
596
- }
599
+ }
0 commit comments