@@ -816,6 +816,9 @@ |
||
| 816 | 816 | return $options; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | + /** |
|
| 820 | + * @param string $name |
|
| 821 | + */ |
|
| 819 | 822 | private function checkCollectionName($name) |
| 820 | 823 | { |
| 821 | 824 | if (empty($name)) { |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function aggregate(array $pipeline, array $op = []) |
| 129 | 129 | { |
| 130 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
| 130 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
| 131 | 131 | $pipeline = []; |
| 132 | 132 | $options = []; |
| 133 | 133 | |
| 134 | 134 | $i = 0; |
| 135 | 135 | foreach (func_get_args() as $operator) { |
| 136 | 136 | $i++; |
| 137 | - if (! is_array($operator)) { |
|
| 137 | + if ( ! is_array($operator)) { |
|
| 138 | 138 | trigger_error("Argument $i is not an array", E_WARNING); |
| 139 | 139 | return; |
| 140 | 140 | } |
@@ -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,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function insert($a, array $options = []) |
| 264 | 264 | { |
| 265 | - if (! count((array)$a)) { |
|
| 265 | + if ( ! count((array) $a)) { |
|
| 266 | 266 | throw new \MongoException('document must be an array or object'); |
| 267 | 267 | } |
| 268 | 268 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
| 279 | - if (! $result->isAcknowledged()) { |
|
| 279 | + if ( ! $result->isAcknowledged()) { |
|
| 280 | 280 | return true; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | ExceptionConverter::toLegacy($e); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (! $result->isAcknowledged()) { |
|
| 311 | + if ( ! $result->isAcknowledged()) { |
|
| 312 | 312 | return true; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * @throws MongoCursorException |
| 333 | 333 | * @return boolean |
| 334 | 334 | */ |
| 335 | - public function update(array $criteria , array $newobj, array $options = []) |
|
| 335 | + public function update(array $criteria, array $newobj, array $options = []) |
|
| 336 | 336 | { |
| 337 | 337 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
| 338 | 338 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | ExceptionConverter::toLegacy($e); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if (! $result->isAcknowledged()) { |
|
| 352 | + if ( ! $result->isAcknowledged()) { |
|
| 353 | 353 | return true; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | public function remove(array $criteria = [], array $options = []) |
| 378 | 378 | { |
| 379 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
| 379 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
| 380 | 380 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 381 | 381 | |
| 382 | 382 | try { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | ExceptionConverter::toLegacy($e); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if (! $result->isAcknowledged()) { |
|
| 392 | + if ( ! $result->isAcknowledged()) { |
|
| 393 | 393 | return true; |
| 394 | 394 | } |
| 395 | 395 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | */ |
| 519 | 519 | public function createIndex(array $keys, array $options = []) |
| 520 | 520 | { |
| 521 | - if (! is_array($keys) || ! count($keys)) { |
|
| 521 | + if ( ! is_array($keys) || ! count($keys)) { |
|
| 522 | 522 | throw new MongoException('keys cannot be empty'); |
| 523 | 523 | } |
| 524 | 524 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | $options['upsert'] = true; |
| 658 | 658 | |
| 659 | - if (! count($a)) { |
|
| 659 | + if ( ! count($a)) { |
|
| 660 | 660 | throw new MongoException('document can not be empty'); |
| 661 | 661 | } |
| 662 | 662 | |
@@ -675,13 +675,13 @@ discard block |
||
| 675 | 675 | if ($document_or_id instanceof \MongoId) { |
| 676 | 676 | $id = $document_or_id; |
| 677 | 677 | } elseif (is_object($document_or_id)) { |
| 678 | - if (! isset($document_or_id->_id)) { |
|
| 678 | + if ( ! isset($document_or_id->_id)) { |
|
| 679 | 679 | return null; |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | $id = $document_or_id->_id; |
| 683 | 683 | } elseif (is_array($document_or_id)) { |
| 684 | - if (! isset($document_or_id['_id'])) { |
|
| 684 | + if ( ! isset($document_or_id['_id'])) { |
|
| 685 | 685 | return null; |
| 686 | 686 | } |
| 687 | 687 | |
@@ -724,14 +724,14 @@ discard block |
||
| 724 | 724 | $command = [ |
| 725 | 725 | 'group' => [ |
| 726 | 726 | 'ns' => $this->name, |
| 727 | - '$reduce' => (string)$reduce, |
|
| 727 | + '$reduce' => (string) $reduce, |
|
| 728 | 728 | 'initial' => $initial, |
| 729 | 729 | 'cond' => $condition, |
| 730 | 730 | ], |
| 731 | 731 | ]; |
| 732 | 732 | |
| 733 | 733 | if ($keys instanceof MongoCode) { |
| 734 | - $command['group']['$keyf'] = (string)$keys; |
|
| 734 | + $command['group']['$keyf'] = (string) $keys; |
|
| 735 | 735 | } else { |
| 736 | 736 | $command['group']['key'] = $keys; |
| 737 | 737 | } |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | } |
| 741 | 741 | if (array_key_exists('finalize', $condition)) { |
| 742 | 742 | if ($condition['finalize'] instanceof MongoCode) { |
| 743 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 743 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 744 | 744 | } |
| 745 | 745 | $command['group']['finalize'] = $condition['finalize']; |
| 746 | 746 | } |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 797 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 798 | 798 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 801 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 802 | 802 | $collectionWriteConcern = $this->getWriteConcern(); |
| 803 | 803 | $writeConcern = $this->createWriteConcernFromParameters( |
| 804 | 804 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -816,6 +816,9 @@ |
||
| 816 | 816 | return $options; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | + /** |
|
| 820 | + * @param string $name |
|
| 821 | + */ |
|
| 819 | 822 | private function checkCollectionName($name) |
| 820 | 823 | { |
| 821 | 824 | if (empty($name)) { |