@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @link http://www.php.net/manual/en/mongocollection.createindex.php |
| 448 | 448 | * @param array $keys Field or fields to use as index. |
| 449 | 449 | * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...). |
| 450 | - * @return array Returns the database response. |
|
| 450 | + * @return string|false Returns the database response. |
|
| 451 | 451 | * |
| 452 | 452 | * @todo This method does not yet return the correct result |
| 453 | 453 | */ |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error. |
| 548 | 548 | * @throws MongoCursorException if the "w" option is set and the write fails. |
| 549 | 549 | * @throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds. |
| 550 | - * @return array|boolean If w was set, returns an array containing the status of the save. |
|
| 550 | + * @return MongoDB\UpdateResult If w was set, returns an array containing the status of the save. |
|
| 551 | 551 | * Otherwise, returns a boolean representing if the array was not empty (an empty array will not be inserted). |
| 552 | 552 | */ |
| 553 | 553 | public function save($a, array $options = []) |
@@ -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'] : false; |
|
| 357 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : false; |
|
| 358 | 358 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 359 | 359 | |
| 360 | 360 | return $this->collection->$method($criteria, $options); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function find(array $query = [], array $fields = []) |
| 372 | 372 | { |
| 373 | - $cursor = new MongoCursor($this->db->getConnection(), (string)$this, $query, $fields); |
|
| 373 | + $cursor = new MongoCursor($this->db->getConnection(), (string) $this, $query, $fields); |
|
| 374 | 374 | $cursor->setReadPreference($this->getReadPreference()); |
| 375 | 375 | |
| 376 | 376 | return $cursor; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | public function save($a, array $options = []) |
| 554 | 554 | { |
| 555 | 555 | if (is_object($a)) { |
| 556 | - $a = (array)$a; |
|
| 556 | + $a = (array) $a; |
|
| 557 | 557 | } |
| 558 | 558 | if ( ! array_key_exists('_id', $a)) { |
| 559 | 559 | $id = new \MongoId(); |
@@ -626,14 +626,14 @@ discard block |
||
| 626 | 626 | $command = [ |
| 627 | 627 | 'group' => [ |
| 628 | 628 | 'ns' => $this->name, |
| 629 | - '$reduce' => (string)$reduce, |
|
| 629 | + '$reduce' => (string) $reduce, |
|
| 630 | 630 | 'initial' => $initial, |
| 631 | 631 | 'cond' => $condition, |
| 632 | 632 | ], |
| 633 | 633 | ]; |
| 634 | 634 | |
| 635 | 635 | if ($keys instanceof MongoCode) { |
| 636 | - $command['group']['$keyf'] = (string)$keys; |
|
| 636 | + $command['group']['$keyf'] = (string) $keys; |
|
| 637 | 637 | } else { |
| 638 | 638 | $command['group']['key'] = $keys; |
| 639 | 639 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | } |
| 643 | 643 | if (array_key_exists('finalize', $condition)) { |
| 644 | 644 | if ($condition['finalize'] instanceof MongoCode) { |
| 645 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 645 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 646 | 646 | } |
| 647 | 647 | $command['group']['finalize'] = $condition['finalize']; |
| 648 | 648 | } |
@@ -694,11 +694,11 @@ discard block |
||
| 694 | 694 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 697 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 698 | 698 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 701 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 702 | 702 | $collectionWriteConcern = $this->getWriteConcern(); |
| 703 | 703 | $writeConcern = $this->createWriteConcernFromParameters( |
| 704 | 704 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -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 | |