@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function add($item) |
| 77 | 77 | { |
| 78 | 78 | if (is_object($item)) { |
| 79 | - $item = (array)$item; |
|
| 79 | + $item = (array) $item; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $this->validate($item); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | final public function execute(array $writeOptions = []) |
| 96 | 96 | { |
| 97 | 97 | $writeOptions += $this->writeOptions; |
| 98 | - if (! count($this->items)) { |
|
| 98 | + if ( ! count($this->items)) { |
|
| 99 | 99 | return ['ok' => true]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | switch ($this->batchType) { |
| 154 | 154 | case self::COMMAND_UPDATE: |
| 155 | - if (! isset($item['q'])) { |
|
| 155 | + if ( ! isset($item['q'])) { |
|
| 156 | 156 | throw new Exception("Expected $item to contain 'q' key"); |
| 157 | 157 | } |
| 158 | - if (! isset($item['u'])) { |
|
| 158 | + if ( ! isset($item['u'])) { |
|
| 159 | 159 | throw new Exception("Expected $item to contain 'u' key"); |
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | |
| 163 | 163 | case self::COMMAND_DELETE: |
| 164 | - if (! isset($item['q'])) { |
|
| 164 | + if ( ! isset($item['q'])) { |
|
| 165 | 165 | throw new Exception("Expected $item to contain 'q' key"); |
| 166 | 166 | } |
| 167 | - if (! isset($item['limit'])) { |
|
| 167 | + if ( ! isset($item['limit'])) { |
|
| 168 | 168 | throw new Exception("Expected $item to contain 'limit' key"); |
| 169 | 169 | } |
| 170 | 170 | break; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function current() |
| 120 | 120 | { |
| 121 | - if (! $this->startedIterating) { |
|
| 121 | + if ( ! $this->startedIterating) { |
|
| 122 | 122 | return null; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function key() |
| 139 | 139 | { |
| 140 | - if (! $this->startedIterating) { |
|
| 140 | + if ( ! $this->startedIterating) { |
|
| 141 | 141 | return null; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function next() |
| 155 | 155 | { |
| 156 | - if (! $this->startedIterating) { |
|
| 156 | + if ( ! $this->startedIterating) { |
|
| 157 | 157 | $this->ensureIterator(); |
| 158 | 158 | $this->startedIterating = true; |
| 159 | 159 | } else { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function valid() |
| 188 | 188 | { |
| 189 | - if (! $this->startedIterating) { |
|
| 189 | + if ( ! $this->startedIterating) { |
|
| 190 | 190 | return false; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | use Helper\WriteConcern; |
| 29 | 29 | |
| 30 | 30 | const VERSION = '1.6.12'; |
| 31 | - const DEFAULT_HOST = "localhost" ; |
|
| 32 | - const DEFAULT_PORT = 27017 ; |
|
| 33 | - const RP_PRIMARY = "primary" ; |
|
| 34 | - const RP_PRIMARY_PREFERRED = "primaryPreferred" ; |
|
| 35 | - const RP_SECONDARY = "secondary" ; |
|
| 36 | - const RP_SECONDARY_PREFERRED = "secondaryPreferred" ; |
|
| 37 | - const RP_NEAREST = "nearest" ; |
|
| 31 | + const DEFAULT_HOST = "localhost"; |
|
| 32 | + const DEFAULT_PORT = 27017; |
|
| 33 | + const RP_PRIMARY = "primary"; |
|
| 34 | + const RP_PRIMARY_PREFERRED = "primaryPreferred"; |
|
| 35 | + const RP_SECONDARY = "secondary"; |
|
| 36 | + const RP_SECONDARY_PREFERRED = "secondaryPreferred"; |
|
| 37 | + const RP_NEAREST = "nearest"; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @var bool |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $this->server = $server; |
| 86 | 86 | if (false === strpos($this->server, 'mongodb://')) { |
| 87 | - $this->server = 'mongodb://'.$this->server; |
|
| 87 | + $this->server = 'mongodb://' . $this->server; |
|
| 88 | 88 | } |
| 89 | 89 | $this->client = new Client($this->server, $options, $driverOptions); |
| 90 | 90 | $info = $this->client->__debugInfo(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param int|MongoInt64 $id The ID of the cursor to kill. |
| 231 | 231 | * @return bool |
| 232 | 232 | */ |
| 233 | - public function killCursor($server_hash , $id) |
|
| 233 | + public function killCursor($server_hash, $id) |
|
| 234 | 234 | { |
| 235 | 235 | $this->notImplemented(); |
| 236 | 236 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | try { |
| 204 | 204 | $file = $this->insertFile($record, $options); |
| 205 | 205 | } catch (MongoException $e) { |
| 206 | - throw new MongoGridFSException('Could not store file: '. $e->getMessage(), 0, $e); |
|
| 206 | + throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), 0, $e); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | try { |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | ]; |
| 241 | 241 | |
| 242 | 242 | $handle = fopen($filename, 'r'); |
| 243 | - if (! $handle) { |
|
| 243 | + if ( ! $handle) { |
|
| 244 | 244 | throw new MongoGridFSException('could not open file: ' . $filename); |
| 245 | 245 | } |
| 246 | - } elseif (! is_resource($filename)) { |
|
| 246 | + } elseif ( ! is_resource($filename)) { |
|
| 247 | 247 | throw new \Exception('first argument must be a string or stream resource'); |
| 248 | 248 | } else { |
| 249 | 249 | $handle = $filename; |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // Add length and MD5 if they were not present before |
| 268 | 268 | $update = []; |
| 269 | - if (! isset($record['length'])) { |
|
| 269 | + if ( ! isset($record['length'])) { |
|
| 270 | 270 | $update['length'] = $length; |
| 271 | 271 | } |
| 272 | - if (! isset($record['md5'])) { |
|
| 272 | + if ( ! isset($record['md5'])) { |
|
| 273 | 273 | try { |
| 274 | 274 | $update['md5'] = $md5; |
| 275 | 275 | } catch (MongoException $e) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | if (count($update)) { |
| 281 | 281 | try { |
| 282 | 282 | $result = $this->update(['_id' => $file['_id']], ['$set' => $update]); |
| 283 | - if (! $this->isOKResult($result)) { |
|
| 283 | + if ( ! $this->isOKResult($result)) { |
|
| 284 | 284 | throw new MongoGridFSException('Could not store file'); |
| 285 | 285 | } |
| 286 | 286 | } catch (MongoException $e) { |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function storeUpload($name, array $metadata = []) |
| 306 | 306 | { |
| 307 | - if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
| 307 | + if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
| 308 | 308 | throw new MongoGridFSException("Could not find uploaded file $name"); |
| 309 | 309 | } |
| 310 | - if (! isset($_FILES[$name]['tmp_name'])) { |
|
| 310 | + if ( ! isset($_FILES[$name]['tmp_name'])) { |
|
| 311 | 311 | throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?"); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | $result = $this->chunks->insert($chunk); |
| 359 | 359 | |
| 360 | - if (! $this->isOKResult($result)) { |
|
| 360 | + if ( ! $this->isOKResult($result)) { |
|
| 361 | 361 | throw new \MongoException('error inserting chunk'); |
| 362 | 362 | } |
| 363 | 363 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $hash = hash_init('md5'); |
| 403 | 403 | |
| 404 | 404 | rewind($handle); |
| 405 | - while (! feof($handle)) { |
|
| 405 | + while ( ! feof($handle)) { |
|
| 406 | 406 | $data = stream_get_contents($handle, $chunkSize); |
| 407 | 407 | hash_update($hash, $data); |
| 408 | 408 | $this->insertChunk($fileId, $data, $i++); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | $result = $this->insert($record, $options); |
| 434 | 434 | |
| 435 | - if (! $this->isOKResult($result)) { |
|
| 435 | + if ( ! $this->isOKResult($result)) { |
|
| 436 | 436 | throw new \MongoException('error inserting file'); |
| 437 | 437 | } |
| 438 | 438 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | throw ExceptionConverter::toLegacy($e); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $getCollectionInfo = function (CollectionInfo $collectionInfo) { |
|
| 141 | + $getCollectionInfo = function(CollectionInfo $collectionInfo) { |
|
| 142 | 142 | return [ |
| 143 | 143 | 'name' => $collectionInfo->getName(), |
| 144 | 144 | 'options' => $collectionInfo->getOptions(), |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | throw ExceptionConverter::toLegacy($e); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $getCollectionName = function (CollectionInfo $collectionInfo) { |
|
| 178 | + $getCollectionName = function(CollectionInfo $collectionInfo) { |
|
| 179 | 179 | return $collectionInfo->getName(); |
| 180 | 180 | }; |
| 181 | 181 | |
@@ -344,13 +344,13 @@ discard block |
||
| 344 | 344 | if ($document_or_id instanceof \MongoId) { |
| 345 | 345 | $id = $document_or_id; |
| 346 | 346 | } elseif (is_object($document_or_id)) { |
| 347 | - if (! isset($document_or_id->_id)) { |
|
| 347 | + if ( ! isset($document_or_id->_id)) { |
|
| 348 | 348 | $id = $document_or_id; |
| 349 | 349 | } else { |
| 350 | 350 | $id = $document_or_id->_id; |
| 351 | 351 | } |
| 352 | 352 | } elseif (is_array($document_or_id)) { |
| 353 | - if (! isset($document_or_id['_id'])) { |
|
| 353 | + if ( ! isset($document_or_id['_id'])) { |
|
| 354 | 354 | return null; |
| 355 | 355 | } |
| 356 | 356 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | * @return Closure |
| 542 | 542 | */ |
| 543 | 543 | private function getSystemCollectionFilterClosure($includeSystemCollections = false) { |
| 544 | - return function (CollectionInfo $collectionInfo) use ($includeSystemCollections) { |
|
| 544 | + return function(CollectionInfo $collectionInfo) use ($includeSystemCollections) { |
|
| 545 | 545 | return $includeSystemCollections || ! preg_match('#^system\.#', $collectionInfo->getName()); |
| 546 | 546 | }; |
| 547 | 547 | } |
@@ -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 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | ]; |
| 181 | 181 | |
| 182 | 182 | // Convert cursor option |
| 183 | - if (! isset($options['cursor'])) { |
|
| 183 | + if ( ! isset($options['cursor'])) { |
|
| 184 | 184 | $options['cursor'] = new \stdClass(); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function insert(&$a, array $options = []) |
| 268 | 268 | { |
| 269 | - if (! $this->ensureDocumentHasMongoId($a)) { |
|
| 269 | + if ( ! $this->ensureDocumentHasMongoId($a)) { |
|
| 270 | 270 | trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING); |
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (! count((array)$a)) { |
|
| 274 | + if ( ! count((array) $a)) { |
|
| 275 | 275 | throw new \MongoException('document must be an array or object'); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | throw ExceptionConverter::toLegacy($e); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if (! $result->isAcknowledged()) { |
|
| 287 | + if ( ! $result->isAcknowledged()) { |
|
| 288 | 288 | return true; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | foreach ($a as $key => $item) { |
| 317 | 317 | try { |
| 318 | - if (! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 318 | + if ( ! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 319 | 319 | if ($continueOnError) { |
| 320 | 320 | unset($a[$key]); |
| 321 | 321 | } else { |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | throw ExceptionConverter::toLegacy($e, 'MongoResultException'); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if (! $result->isAcknowledged()) { |
|
| 342 | + if ( ! $result->isAcknowledged()) { |
|
| 343 | 343 | return true; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @throws MongoCursorException |
| 364 | 364 | * @return boolean |
| 365 | 365 | */ |
| 366 | - public function update(array $criteria , array $newobj, array $options = []) |
|
| 366 | + public function update(array $criteria, array $newobj, array $options = []) |
|
| 367 | 367 | { |
| 368 | 368 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
| 369 | 369 | $isReplace = ! \MongoDB\is_first_key_operator($newobj); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | throw ExceptionConverter::toLegacy($e); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - if (! $result->isAcknowledged()) { |
|
| 390 | + if ( ! $result->isAcknowledged()) { |
|
| 391 | 391 | return true; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | */ |
| 415 | 415 | public function remove(array $criteria = [], array $options = []) |
| 416 | 416 | { |
| 417 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
| 417 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
| 418 | 418 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 419 | 419 | |
| 420 | 420 | try { |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | throw ExceptionConverter::toLegacy($e); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if (! $result->isAcknowledged()) { |
|
| 430 | + if ( ! $result->isAcknowledged()) { |
|
| 431 | 431 | return true; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | $options['projection'] = is_array($fields) ? TypeConverter::fromLegacy($fields) : []; |
| 501 | 501 | |
| 502 | - if (! \MongoDB\is_first_key_operator($update)) { |
|
| 502 | + if ( ! \MongoDB\is_first_key_operator($update)) { |
|
| 503 | 503 | $document = $this->collection->findOneAndReplace($query, $update, $options); |
| 504 | 504 | } else { |
| 505 | 505 | $document = $this->collection->findOneAndUpdate($query, $update, $options); |
@@ -564,11 +564,11 @@ discard block |
||
| 564 | 564 | $keys = (array) $keys; |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - if (! is_array($keys) || ! count($keys)) { |
|
| 567 | + if ( ! is_array($keys) || ! count($keys)) { |
|
| 568 | 568 | throw new MongoException('index specification has no elements'); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - if (! isset($options['name'])) { |
|
| 571 | + if ( ! isset($options['name'])) { |
|
| 572 | 572 | $options['name'] = \MongoDB\generate_index_name($keys); |
| 573 | 573 | } |
| 574 | 574 | |
@@ -597,14 +597,14 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | $result = [ |
| 600 | - 'createdCollectionAutomatically' => !$collectionExists, |
|
| 600 | + 'createdCollectionAutomatically' => ! $collectionExists, |
|
| 601 | 601 | 'numIndexesBefore' => $indexCount, |
| 602 | 602 | 'numIndexesAfter' => $indexCount, |
| 603 | 603 | 'note' => 'all indexes already exist', |
| 604 | 604 | 'ok' => 1.0, |
| 605 | 605 | ]; |
| 606 | 606 | |
| 607 | - if (! $indexExists) { |
|
| 607 | + if ( ! $indexExists) { |
|
| 608 | 608 | $result['numIndexesAfter']++; |
| 609 | 609 | unset($result['note']); |
| 610 | 610 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | if (is_string($keys)) { |
| 639 | 639 | $indexName = $keys; |
| 640 | - if (! preg_match('#_-?1$#', $indexName)) { |
|
| 640 | + if ( ! preg_match('#_-?1$#', $indexName)) { |
|
| 641 | 641 | $indexName .= '_1'; |
| 642 | 642 | } |
| 643 | 643 | } elseif (is_array($keys)) { |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | $this->convertWriteConcernOptions($options) |
| 734 | 734 | ); |
| 735 | 735 | |
| 736 | - if (! $result->isAcknowledged()) { |
|
| 736 | + if ( ! $result->isAcknowledged()) { |
|
| 737 | 737 | return true; |
| 738 | 738 | } |
| 739 | 739 | |
@@ -767,13 +767,13 @@ discard block |
||
| 767 | 767 | if ($document_or_id instanceof \MongoId) { |
| 768 | 768 | $id = $document_or_id; |
| 769 | 769 | } elseif (is_object($document_or_id)) { |
| 770 | - if (! isset($document_or_id->_id)) { |
|
| 770 | + if ( ! isset($document_or_id->_id)) { |
|
| 771 | 771 | return null; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | $id = $document_or_id->_id; |
| 775 | 775 | } elseif (is_array($document_or_id)) { |
| 776 | - if (! isset($document_or_id['_id'])) { |
|
| 776 | + if ( ! isset($document_or_id['_id'])) { |
|
| 777 | 777 | return null; |
| 778 | 778 | } |
| 779 | 779 | |
@@ -816,14 +816,14 @@ discard block |
||
| 816 | 816 | $command = [ |
| 817 | 817 | 'group' => [ |
| 818 | 818 | 'ns' => $this->name, |
| 819 | - '$reduce' => (string)$reduce, |
|
| 819 | + '$reduce' => (string) $reduce, |
|
| 820 | 820 | 'initial' => $initial, |
| 821 | 821 | 'cond' => $condition, |
| 822 | 822 | ], |
| 823 | 823 | ]; |
| 824 | 824 | |
| 825 | 825 | if ($keys instanceof MongoCode) { |
| 826 | - $command['group']['$keyf'] = (string)$keys; |
|
| 826 | + $command['group']['$keyf'] = (string) $keys; |
|
| 827 | 827 | } else { |
| 828 | 828 | $command['group']['key'] = $keys; |
| 829 | 829 | } |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | } |
| 833 | 833 | if (array_key_exists('finalize', $condition)) { |
| 834 | 834 | if ($condition['finalize'] instanceof MongoCode) { |
| 835 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 835 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 836 | 836 | } |
| 837 | 837 | $command['group']['finalize'] = $condition['finalize']; |
| 838 | 838 | } |
@@ -886,11 +886,11 @@ discard block |
||
| 886 | 886 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 889 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 890 | 890 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 893 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 894 | 894 | $collectionWriteConcern = $this->getWriteConcern(); |
| 895 | 895 | $writeConcern = $this->createWriteConcernFromParameters( |
| 896 | 896 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | }; |
| 924 | 924 | |
| 925 | 925 | if (is_array($document)) { |
| 926 | - if (! isset($document['_id'])) { |
|
| 926 | + if ( ! isset($document['_id'])) { |
|
| 927 | 927 | $document['_id'] = new \MongoId(); |
| 928 | 928 | } |
| 929 | 929 | |
@@ -933,12 +933,12 @@ discard block |
||
| 933 | 933 | } elseif (is_object($document)) { |
| 934 | 934 | $reflectionObject = new \ReflectionObject($document); |
| 935 | 935 | foreach ($reflectionObject->getProperties() as $property) { |
| 936 | - if (! $property->isPublic()) { |
|
| 936 | + if ( ! $property->isPublic()) { |
|
| 937 | 937 | throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?'); |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | - if (! isset($document->_id)) { |
|
| 941 | + if ( ! isset($document->_id)) { |
|
| 942 | 942 | $document->_id = new \MongoId(); |
| 943 | 943 | } |
| 944 | 944 | |