@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $collections = $this->db->listCollections($options); |
| 134 | 134 | |
| 135 | - $getCollectionInfo = function (CollectionInfo $collectionInfo) { |
|
| 135 | + $getCollectionInfo = function(CollectionInfo $collectionInfo) { |
|
| 136 | 136 | return [ |
| 137 | 137 | 'name' => $collectionInfo->getName(), |
| 138 | 138 | 'options' => $collectionInfo->getOptions(), |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $collections = $this->db->listCollections($options); |
| 160 | 160 | |
| 161 | - $getCollectionName = function (CollectionInfo $collectionInfo) { |
|
| 161 | + $getCollectionName = function(CollectionInfo $collectionInfo) { |
|
| 162 | 162 | return $collectionInfo->getName(); |
| 163 | 163 | }; |
| 164 | 164 | |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | if ($document_or_id instanceof \MongoId) { |
| 308 | 308 | $id = $document_or_id; |
| 309 | 309 | } elseif (is_object($document_or_id)) { |
| 310 | - if (! isset($document_or_id->_id)) { |
|
| 310 | + if ( ! isset($document_or_id->_id)) { |
|
| 311 | 311 | return null; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $id = $document_or_id->_id; |
| 315 | 315 | } elseif (is_array($document_or_id)) { |
| 316 | - if (! isset($document_or_id['_id'])) { |
|
| 316 | + if ( ! isset($document_or_id['_id'])) { |
|
| 317 | 317 | return null; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -468,7 +468,7 @@ |
||
| 468 | 468 | * @link http://www.php.net/manual/en/mongocollection.createindex.php |
| 469 | 469 | * @param array $keys Field or fields to use as index. |
| 470 | 470 | * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...). |
| 471 | - * @return array Returns the database response. |
|
| 471 | + * @return string|false Returns the database response. |
|
| 472 | 472 | * |
| 473 | 473 | * @todo This method does not yet return the correct result |
| 474 | 474 | */ |
@@ -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']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
| 173 | + if ( ! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
| 174 | 174 | // Cursor option needs to be an object convert bools and empty arrays since those won't be handled by TypeConverter |
| 175 | 175 | $options['cursor'] = new \stdClass; |
| 176 | 176 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $this->convertWriteConcernOptions($options) |
| 263 | 263 | ); |
| 264 | 264 | |
| 265 | - if (! $result->isAcknowledged()) { |
|
| 265 | + if ( ! $result->isAcknowledged()) { |
|
| 266 | 266 | return true; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $this->convertWriteConcernOptions($options) |
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | - if (! $result->isAcknowledged()) { |
|
| 293 | + if ( ! $result->isAcknowledged()) { |
|
| 294 | 294 | return true; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @throws MongoCursorException |
| 315 | 315 | * @return boolean |
| 316 | 316 | */ |
| 317 | - public function update(array $criteria , array $newobj, array $options = []) |
|
| 317 | + public function update(array $criteria, array $newobj, array $options = []) |
|
| 318 | 318 | { |
| 319 | 319 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
| 320 | 320 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $this->convertWriteConcernOptions($options) |
| 328 | 328 | ); |
| 329 | 329 | |
| 330 | - if (! $result->isAcknowledged()) { |
|
| 330 | + if ( ! $result->isAcknowledged()) { |
|
| 331 | 331 | return true; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function remove(array $criteria = [], array $options = []) |
| 356 | 356 | { |
| 357 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
| 357 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
| 358 | 358 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 359 | 359 | |
| 360 | 360 | /** @var \MongoDB\DeleteResult $result */ |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $this->convertWriteConcernOptions($options) |
| 364 | 364 | ); |
| 365 | 365 | |
| 366 | - if (! $result->isAcknowledged()) { |
|
| 366 | + if ( ! $result->isAcknowledged()) { |
|
| 367 | 367 | return true; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -606,13 +606,13 @@ discard block |
||
| 606 | 606 | if ($document_or_id instanceof \MongoId) { |
| 607 | 607 | $id = $document_or_id; |
| 608 | 608 | } elseif (is_object($document_or_id)) { |
| 609 | - if (! isset($document_or_id->_id)) { |
|
| 609 | + if ( ! isset($document_or_id->_id)) { |
|
| 610 | 610 | return null; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | $id = $document_or_id->_id; |
| 614 | 614 | } elseif (is_array($document_or_id)) { |
| 615 | - if (! isset($document_or_id['_id'])) { |
|
| 615 | + if ( ! isset($document_or_id['_id'])) { |
|
| 616 | 616 | return null; |
| 617 | 617 | } |
| 618 | 618 | |
@@ -655,14 +655,14 @@ discard block |
||
| 655 | 655 | $command = [ |
| 656 | 656 | 'group' => [ |
| 657 | 657 | 'ns' => $this->name, |
| 658 | - '$reduce' => (string)$reduce, |
|
| 658 | + '$reduce' => (string) $reduce, |
|
| 659 | 659 | 'initial' => $initial, |
| 660 | 660 | 'cond' => $condition, |
| 661 | 661 | ], |
| 662 | 662 | ]; |
| 663 | 663 | |
| 664 | 664 | if ($keys instanceof MongoCode) { |
| 665 | - $command['group']['$keyf'] = (string)$keys; |
|
| 665 | + $command['group']['$keyf'] = (string) $keys; |
|
| 666 | 666 | } else { |
| 667 | 667 | $command['group']['key'] = $keys; |
| 668 | 668 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | if (array_key_exists('finalize', $condition)) { |
| 673 | 673 | if ($condition['finalize'] instanceof MongoCode) { |
| 674 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 674 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 675 | 675 | } |
| 676 | 676 | $command['group']['finalize'] = $condition['finalize']; |
| 677 | 677 | } |
@@ -725,11 +725,11 @@ discard block |
||
| 725 | 725 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 728 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 729 | 729 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 732 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 733 | 733 | $collectionWriteConcern = $this->getWriteConcern(); |
| 734 | 734 | $writeConcern = $this->createWriteConcernFromParameters( |
| 735 | 735 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |