@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function aggregate(array $pipeline, array $op = []) |
127 | 127 | { |
128 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
128 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
129 | 129 | $pipeline = []; |
130 | 130 | $options = []; |
131 | 131 | |
132 | 132 | $i = 0; |
133 | 133 | foreach (func_get_args() as $operator) { |
134 | 134 | $i++; |
135 | - if (! is_array($operator)) { |
|
135 | + if ( ! is_array($operator)) { |
|
136 | 136 | trigger_error("Argument $i is not an array", E_WARNING); |
137 | 137 | return; |
138 | 138 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ]; |
171 | 171 | |
172 | 172 | // Convert cursor option |
173 | - if (! isset($options['cursor'])) { |
|
173 | + if ( ! isset($options['cursor'])) { |
|
174 | 174 | $options['cursor'] = true; |
175 | 175 | } |
176 | 176 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function insert(&$a, array $options = []) |
258 | 258 | { |
259 | - if (! $this->ensureDocumentHasMongoId($a)) { |
|
259 | + if ( ! $this->ensureDocumentHasMongoId($a)) { |
|
260 | 260 | trigger_error(sprintf('%s expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_WARNING); |
261 | 261 | return; |
262 | 262 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->convertWriteConcernOptions($options) |
267 | 267 | ); |
268 | 268 | |
269 | - if (! $result->isAcknowledged()) { |
|
269 | + if ( ! $result->isAcknowledged()) { |
|
270 | 270 | return true; |
271 | 271 | } |
272 | 272 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $this->convertWriteConcernOptions($options) |
299 | 299 | ); |
300 | 300 | |
301 | - if (! $result->isAcknowledged()) { |
|
301 | + if ( ! $result->isAcknowledged()) { |
|
302 | 302 | return true; |
303 | 303 | } |
304 | 304 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @throws MongoCursorException |
323 | 323 | * @return boolean |
324 | 324 | */ |
325 | - public function update(array $criteria , array $newobj, array $options = []) |
|
325 | + public function update(array $criteria, array $newobj, array $options = []) |
|
326 | 326 | { |
327 | 327 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
328 | 328 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->convertWriteConcernOptions($options) |
336 | 336 | ); |
337 | 337 | |
338 | - if (! $result->isAcknowledged()) { |
|
338 | + if ( ! $result->isAcknowledged()) { |
|
339 | 339 | return true; |
340 | 340 | } |
341 | 341 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function remove(array $criteria = [], array $options = []) |
364 | 364 | { |
365 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
365 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
366 | 366 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
367 | 367 | |
368 | 368 | /** @var \MongoDB\DeleteResult $result */ |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $this->convertWriteConcernOptions($options) |
372 | 372 | ); |
373 | 373 | |
374 | - if (! $result->isAcknowledged()) { |
|
374 | + if ( ! $result->isAcknowledged()) { |
|
375 | 375 | return true; |
376 | 376 | } |
377 | 377 | |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | if ($document_or_id instanceof \MongoId) { |
610 | 610 | $id = $document_or_id; |
611 | 611 | } elseif (is_object($document_or_id)) { |
612 | - if (! isset($document_or_id->_id)) { |
|
612 | + if ( ! isset($document_or_id->_id)) { |
|
613 | 613 | return null; |
614 | 614 | } |
615 | 615 | |
616 | 616 | $id = $document_or_id->_id; |
617 | 617 | } elseif (is_array($document_or_id)) { |
618 | - if (! isset($document_or_id['_id'])) { |
|
618 | + if ( ! isset($document_or_id['_id'])) { |
|
619 | 619 | return null; |
620 | 620 | } |
621 | 621 | |
@@ -658,14 +658,14 @@ discard block |
||
658 | 658 | $command = [ |
659 | 659 | 'group' => [ |
660 | 660 | 'ns' => $this->name, |
661 | - '$reduce' => (string)$reduce, |
|
661 | + '$reduce' => (string) $reduce, |
|
662 | 662 | 'initial' => $initial, |
663 | 663 | 'cond' => $condition, |
664 | 664 | ], |
665 | 665 | ]; |
666 | 666 | |
667 | 667 | if ($keys instanceof MongoCode) { |
668 | - $command['group']['$keyf'] = (string)$keys; |
|
668 | + $command['group']['$keyf'] = (string) $keys; |
|
669 | 669 | } else { |
670 | 670 | $command['group']['key'] = $keys; |
671 | 671 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | } |
675 | 675 | if (array_key_exists('finalize', $condition)) { |
676 | 676 | if ($condition['finalize'] instanceof MongoCode) { |
677 | - $condition['finalize'] = (string)$condition['finalize']; |
|
677 | + $condition['finalize'] = (string) $condition['finalize']; |
|
678 | 678 | } |
679 | 679 | $command['group']['finalize'] = $condition['finalize']; |
680 | 680 | } |
@@ -728,11 +728,11 @@ discard block |
||
728 | 728 | $options['w'] = ($options['safe']) ? 1 : 0; |
729 | 729 | } |
730 | 730 | |
731 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
731 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
732 | 732 | $options['wTimeoutMS'] = $options['wtimeout']; |
733 | 733 | } |
734 | 734 | |
735 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
735 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
736 | 736 | $collectionWriteConcern = $this->getWriteConcern(); |
737 | 737 | $writeConcern = $this->createWriteConcernFromParameters( |
738 | 738 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -757,13 +757,13 @@ discard block |
||
757 | 757 | private function ensureDocumentHasMongoId(&$document) |
758 | 758 | { |
759 | 759 | if (is_array($document)) { |
760 | - if (! isset($document['_id'])) { |
|
760 | + if ( ! isset($document['_id'])) { |
|
761 | 761 | $document['_id'] = new \MongoId(); |
762 | 762 | } |
763 | 763 | |
764 | 764 | return $document['_id']; |
765 | 765 | } elseif (is_object($document)) { |
766 | - if (! isset($document->_id)) { |
|
766 | + if ( ! isset($document->_id)) { |
|
767 | 767 | $document->_id = new \MongoId(); |
768 | 768 | } |
769 | 769 |