@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $collections = $this->db->listCollections($options); |
131 | 131 | |
132 | - $getCollectionName = function (CollectionInfo $collectionInfo) { |
|
132 | + $getCollectionName = function(CollectionInfo $collectionInfo) { |
|
133 | 133 | return $collectionInfo->getName(); |
134 | 134 | }; |
135 | 135 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $id = isset($document_or_id->_id) ? $document_or_id->_id : null; |
316 | 316 | // $id = $document_or_id->_id ?? null; |
317 | 317 | } elseif (is_array($document_or_id)) { |
318 | - if (! isset($document_or_id['_id'])) { |
|
318 | + if (!isset($document_or_id['_id'])) { |
|
319 | 319 | return null; |
320 | 320 | } |
321 | 321 |
@@ -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,14 +170,14 @@ 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 | } |
177 | 177 | |
178 | 178 | $command += $options; |
179 | 179 | |
180 | - $cursor = new MongoCommandCursor($this->db->getConnection(), (string)$this, $command); |
|
180 | + $cursor = new MongoCommandCursor($this->db->getConnection(), (string) $this, $command); |
|
181 | 181 | $cursor->setReadPreference($this->getReadPreference()); |
182 | 182 | |
183 | 183 | return $cursor; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @throws MongoCursorException |
285 | 285 | * @return boolean |
286 | 286 | */ |
287 | - public function update(array $criteria , array $newobj, array $options = []) |
|
287 | + public function update(array $criteria, array $newobj, array $options = []) |
|
288 | 288 | { |
289 | 289 | $multiple = ($options['multiple']) ? $options['multiple'] : false; |
290 | 290 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function find(array $query = [], array $fields = []) |
323 | 323 | { |
324 | - $cursor = new MongoCursor($this->db->getConnection(), (string)$this, $query, $fields); |
|
324 | + $cursor = new MongoCursor($this->db->getConnection(), (string) $this, $query, $fields); |
|
325 | 325 | $cursor->setReadPreference($this->getReadPreference()); |
326 | 326 | |
327 | 327 | return $cursor; |
@@ -504,9 +504,9 @@ discard block |
||
504 | 504 | public function save($a, array $options = []) |
505 | 505 | { |
506 | 506 | if (is_object($a)) { |
507 | - $a = (array)$a; |
|
507 | + $a = (array) $a; |
|
508 | 508 | } |
509 | - if ( ! array_key_exists('_id', $a)) { |
|
509 | + if (!array_key_exists('_id', $a)) { |
|
510 | 510 | $id = new \MongoId(); |
511 | 511 | } else { |
512 | 512 | $id = $a['_id']; |
@@ -571,20 +571,20 @@ discard block |
||
571 | 571 | if (is_string($reduce)) { |
572 | 572 | $reduce = new MongoCode($reduce); |
573 | 573 | } |
574 | - if ( ! $reduce instanceof MongoCode) { |
|
574 | + if (!$reduce instanceof MongoCode) { |
|
575 | 575 | throw new \InvalidArgumentExcption('reduce parameter should be a string or MongoCode instance.'); |
576 | 576 | } |
577 | 577 | $command = [ |
578 | 578 | 'group' => [ |
579 | 579 | 'ns' => $this->name, |
580 | - '$reduce' => (string)$reduce, |
|
580 | + '$reduce' => (string) $reduce, |
|
581 | 581 | 'initial' => $initial, |
582 | 582 | 'cond' => $condition, |
583 | 583 | ], |
584 | 584 | ]; |
585 | 585 | |
586 | 586 | if ($keys instanceof MongoCode) { |
587 | - $command['group']['$keyf'] = (string)$keys; |
|
587 | + $command['group']['$keyf'] = (string) $keys; |
|
588 | 588 | } else { |
589 | 589 | $command['group']['key'] = $keys; |
590 | 590 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } |
594 | 594 | if (array_key_exists('finalize', $condition)) { |
595 | 595 | if ($condition['finalize'] instanceof MongoCode) { |
596 | - $condition['finalize'] = (string)$condition['finalize']; |
|
596 | + $condition['finalize'] = (string) $condition['finalize']; |
|
597 | 597 | } |
598 | 598 | $command['group']['finalize'] = $condition['finalize']; |
599 | 599 | } |