@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function aggregate(array $pipeline, array $op = []) |
128 | 128 | { |
129 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
129 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
130 | 130 | $pipeline = []; |
131 | 131 | $options = []; |
132 | 132 | |
133 | 133 | $i = 0; |
134 | 134 | foreach (func_get_args() as $operator) { |
135 | 135 | $i++; |
136 | - if (! is_array($operator)) { |
|
136 | + if ( ! is_array($operator)) { |
|
137 | 137 | trigger_error("Argument $i is not an array", E_WARNING); |
138 | 138 | return; |
139 | 139 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | ]; |
177 | 177 | |
178 | 178 | // Convert cursor option |
179 | - if (! isset($options['cursor'])) { |
|
179 | + if ( ! isset($options['cursor'])) { |
|
180 | 180 | $options['cursor'] = true; |
181 | 181 | } |
182 | 182 | |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function insert(&$a, array $options = []) |
264 | 264 | { |
265 | - if (! $this->ensureDocumentHasMongoId($a)) { |
|
265 | + if ( ! $this->ensureDocumentHasMongoId($a)) { |
|
266 | 266 | trigger_error(sprintf('%s expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING); |
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | - if (! count((array)$a)) { |
|
270 | + if ( ! count((array) $a)) { |
|
271 | 271 | throw new \MongoException('document must be an array or object'); |
272 | 272 | } |
273 | 273 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ExceptionConverter::toLegacy($e); |
290 | 290 | } |
291 | 291 | |
292 | - if (! $result->isAcknowledged()) { |
|
292 | + if ( ! $result->isAcknowledged()) { |
|
293 | 293 | return true; |
294 | 294 | } |
295 | 295 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | foreach ($a as $key => $item) { |
322 | 322 | try { |
323 | - if (! $this->ensureDocumentHasMongoId($a[$key])) { |
|
323 | + if ( ! $this->ensureDocumentHasMongoId($a[$key])) { |
|
324 | 324 | if ($continueOnError) { |
325 | 325 | unset($a[$key]); |
326 | 326 | } else { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | ExceptionConverter::toLegacy($e); |
345 | 345 | } |
346 | 346 | |
347 | - if (! $result->isAcknowledged()) { |
|
347 | + if ( ! $result->isAcknowledged()) { |
|
348 | 348 | return true; |
349 | 349 | } |
350 | 350 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @throws MongoCursorException |
369 | 369 | * @return boolean |
370 | 370 | */ |
371 | - public function update(array $criteria , array $newobj, array $options = []) |
|
371 | + public function update(array $criteria, array $newobj, array $options = []) |
|
372 | 372 | { |
373 | 373 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
374 | 374 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | ExceptionConverter::toLegacy($e); |
397 | 397 | } |
398 | 398 | |
399 | - if (! $result->isAcknowledged()) { |
|
399 | + if ( ! $result->isAcknowledged()) { |
|
400 | 400 | return true; |
401 | 401 | } |
402 | 402 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function remove(array $criteria = [], array $options = []) |
425 | 425 | { |
426 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
426 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
427 | 427 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
428 | 428 | |
429 | 429 | try { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | ExceptionConverter::toLegacy($e); |
437 | 437 | } |
438 | 438 | |
439 | - if (! $result->isAcknowledged()) { |
|
439 | + if ( ! $result->isAcknowledged()) { |
|
440 | 440 | return true; |
441 | 441 | } |
442 | 442 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | } else { |
502 | 502 | $update = is_array($update) ? TypeConverter::fromLegacy($update) : []; |
503 | 503 | |
504 | - if (!\MongoDB\is_first_key_operator($update)) { |
|
504 | + if ( ! \MongoDB\is_first_key_operator($update)) { |
|
505 | 505 | $update = ['$set' => $update]; |
506 | 506 | } |
507 | 507 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $keys = (array) $keys; |
576 | 576 | } |
577 | 577 | |
578 | - if (! is_array($keys) || ! count($keys)) { |
|
578 | + if ( ! is_array($keys) || ! count($keys)) { |
|
579 | 579 | throw new MongoException('keys cannot be empty'); |
580 | 580 | } |
581 | 581 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $indexes = $this->collection->listIndexes(); |
586 | 586 | foreach ($indexes as $index) { |
587 | 587 | |
588 | - if (! empty($options['name']) && $index->getName() === $options['name']) { |
|
588 | + if ( ! empty($options['name']) && $index->getName() === $options['name']) { |
|
589 | 589 | throw new \MongoResultException(sprintf('index with name: %s already exists', $index->getName())); |
590 | 590 | } |
591 | 591 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | ExceptionConverter::toLegacy($e); |
737 | 737 | } |
738 | 738 | |
739 | - if (!$result->isAcknowledged()) { |
|
739 | + if ( ! $result->isAcknowledged()) { |
|
740 | 740 | return true; |
741 | 741 | } |
742 | 742 | |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | if ($document_or_id instanceof \MongoId) { |
763 | 763 | $id = $document_or_id; |
764 | 764 | } elseif (is_object($document_or_id)) { |
765 | - if (! isset($document_or_id->_id)) { |
|
765 | + if ( ! isset($document_or_id->_id)) { |
|
766 | 766 | return null; |
767 | 767 | } |
768 | 768 | |
769 | 769 | $id = $document_or_id->_id; |
770 | 770 | } elseif (is_array($document_or_id)) { |
771 | - if (! isset($document_or_id['_id'])) { |
|
771 | + if ( ! isset($document_or_id['_id'])) { |
|
772 | 772 | return null; |
773 | 773 | } |
774 | 774 | |
@@ -811,14 +811,14 @@ discard block |
||
811 | 811 | $command = [ |
812 | 812 | 'group' => [ |
813 | 813 | 'ns' => $this->name, |
814 | - '$reduce' => (string)$reduce, |
|
814 | + '$reduce' => (string) $reduce, |
|
815 | 815 | 'initial' => $initial, |
816 | 816 | 'cond' => $condition, |
817 | 817 | ], |
818 | 818 | ]; |
819 | 819 | |
820 | 820 | if ($keys instanceof MongoCode) { |
821 | - $command['group']['$keyf'] = (string)$keys; |
|
821 | + $command['group']['$keyf'] = (string) $keys; |
|
822 | 822 | } else { |
823 | 823 | $command['group']['key'] = $keys; |
824 | 824 | } |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } |
828 | 828 | if (array_key_exists('finalize', $condition)) { |
829 | 829 | if ($condition['finalize'] instanceof MongoCode) { |
830 | - $condition['finalize'] = (string)$condition['finalize']; |
|
830 | + $condition['finalize'] = (string) $condition['finalize']; |
|
831 | 831 | } |
832 | 832 | $command['group']['finalize'] = $condition['finalize']; |
833 | 833 | } |
@@ -881,11 +881,11 @@ discard block |
||
881 | 881 | $options['w'] = ($options['safe']) ? 1 : 0; |
882 | 882 | } |
883 | 883 | |
884 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
884 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
885 | 885 | $options['wTimeoutMS'] = $options['wtimeout']; |
886 | 886 | } |
887 | 887 | |
888 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
888 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
889 | 889 | $collectionWriteConcern = $this->getWriteConcern(); |
890 | 890 | $writeConcern = $this->createWriteConcernFromParameters( |
891 | 891 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | if (empty($document)) { |
922 | 922 | throw new \MongoException('document cannot be empty'); |
923 | 923 | } |
924 | - if (! isset($document['_id'])) { |
|
924 | + if ( ! isset($document['_id'])) { |
|
925 | 925 | $document['_id'] = new \MongoId(); |
926 | 926 | } |
927 | 927 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | if (empty((array) $document)) { |
933 | 933 | throw new \MongoException('document cannot be empty'); |
934 | 934 | } |
935 | - if (! isset($document->_id)) { |
|
935 | + if ( ! isset($document->_id)) { |
|
936 | 936 | $document->_id = new \MongoId(); |
937 | 937 | } |
938 | 938 |