@@ -200,7 +200,7 @@ |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * @param $id |
|
| 203 | + * @param string|null $id |
|
| 204 | 204 | * @throws MongoException |
| 205 | 205 | */ |
| 206 | 206 | private function createObjectID($id) |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | { |
| 49 | 49 | if ($value instanceof ObjectID || $value instanceof MongoId) { |
| 50 | 50 | return true; |
| 51 | - } elseif (! is_string($value)) { |
|
| 51 | + } elseif ( ! is_string($value)) { |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * http://php.net/manual/en/mongoresultexception.getdocument.php |
| 26 | 26 | * @return array <p>The full result document as an array, including partial data if available and additional keys.</p> |
| 27 | 27 | */ |
| 28 | - public function getDocument () {} |
|
| 28 | + public function getDocument() {} |
|
| 29 | 29 | |
| 30 | 30 | public $document; |
| 31 | 31 | |
@@ -18,13 +18,16 @@ |
||
| 18 | 18 | * @link http://php.net/manual/en/class.mongoresultexception.php#mongoresultexception.props.document |
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | -class MongoResultException extends MongoException { |
|
| 21 | +class MongoResultException extends MongoException |
|
| 22 | +{ |
|
| 22 | 23 | /** |
| 23 | 24 | * Retrieve the full result document |
| 24 | 25 | * http://php.net/manual/en/mongoresultexception.getdocument.php |
| 25 | 26 | * @return array <p>The full result document as an array, including partial data if available and additional keys.</p> |
| 26 | 27 | */ |
| 27 | - public function getDocument () {} |
|
| 28 | + public function getDocument () |
|
| 29 | + { |
|
| 30 | +} |
|
| 28 | 31 | |
| 29 | 32 | public $document; |
| 30 | 33 | |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | use Alcaeus\MongoDbAdapter\TypeInterface; |
| 17 | 17 | use MongoDB\BSON\Binary; |
| 18 | -use MongoDB\BSON\Type; |
|
| 19 | 18 | |
| 20 | 19 | class MongoBinData implements TypeInterface |
| 21 | 20 | { |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | use Alcaeus\MongoDbAdapter\AbstractCursor; |
| 17 | 17 | use MongoDB\Driver\Cursor; |
| 18 | -use MongoDB\Driver\ReadPreference; |
|
| 19 | 18 | use MongoDB\Operation\Find; |
| 20 | 19 | |
| 21 | 20 | /** |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | protected function convertCursorType() |
| 396 | 396 | { |
| 397 | - if (! $this->tailable) { |
|
| 397 | + if ( ! $this->tailable) { |
|
| 398 | 398 | return null; |
| 399 | 399 | } |
| 400 | 400 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | protected function wrapTraversable(\Traversable $traversable) |
| 436 | 436 | { |
| 437 | 437 | foreach ($traversable as $key => $value) { |
| 438 | - if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || !is_object($value->_id))) { |
|
| 438 | + if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || ! is_object($value->_id))) { |
|
| 439 | 439 | $key = (string) $value->_id; |
| 440 | 440 | } |
| 441 | 441 | yield $key => $value; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @link http://www.php.net/manual/en/mongocursor.hasnext.php |
| 214 | 214 | * @throws MongoConnectionException |
| 215 | 215 | * @throws MongoCursorTimeoutException |
| 216 | - * @return bool Returns true if there is another element |
|
| 216 | + * @return boolean|null Returns true if there is another element |
|
| 217 | 217 | */ |
| 218 | 218 | public function hasNext() |
| 219 | 219 | { |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
| 460 | - * @return array |
|
| 460 | + * @return string[] |
|
| 461 | 461 | */ |
| 462 | 462 | public function __sleep() |
| 463 | 463 | { |
@@ -126,6 +126,9 @@ |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param resource $handle |
|
| 131 | + */ |
|
| 129 | 132 | private function writeFromRessource($handle) |
| 130 | 133 | { |
| 131 | 134 | |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $filename = 'file'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (! $handle = fopen($filename, 'w')) { |
|
| 78 | + if ( ! $handle = fopen($filename, 'w')) { |
|
| 79 | 79 | trigger_error(E_ERROR, 'Can not open the destination file'); |
| 80 | 80 | return 0; |
| 81 | 81 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * Returns the address being used by this for slaveOkay reads |
| 49 | 49 | * |
| 50 | 50 | * @link http://php.net/manual/en/mongo.getslave.php |
| 51 | - * @return bool The address of the secondary this connection is using for |
|
| 51 | + * @return boolean|null The address of the secondary this connection is using for |
|
| 52 | 52 | * reads. This returns NULL if this is not connected to a replica set or not yet |
| 53 | 53 | * initialized. |
| 54 | 54 | */ |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * Get slaveOkay setting for this connection |
| 62 | 62 | * |
| 63 | 63 | * @link http://php.net/manual/en/mongo.getslaveokay.php |
| 64 | - * @return bool Returns the value of slaveOkay for this instance. |
|
| 64 | + * @return boolean|null Returns the value of slaveOkay for this instance. |
|
| 65 | 65 | */ |
| 66 | 66 | public function getSlaveOkay() |
| 67 | 67 | { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @link http://www.php.net/manual/en/mongo.pairconnect.php |
| 75 | 75 | * @throws MongoConnectionException |
| 76 | - * @return boolean |
|
| 76 | + * @return boolean|null |
|
| 77 | 77 | * |
| 78 | 78 | * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method. |
| 79 | 79 | */ |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @link http://php.net/manual/en/mongo.setslaveokay.php |
| 101 | 101 | * @param bool $ok |
| 102 | - * @return bool returns the former value of slaveOkay for this instance. |
|
| 102 | + * @return boolean|null returns the former value of slaveOkay for this instance. |
|
| 103 | 103 | */ |
| 104 | 104 | public function setSlaveOkay ($ok) |
| 105 | 105 | { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @link http://php.net/manual/en/mongo.setpoolsize.php |
| 113 | 113 | * @param $size <p>The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.</p> |
| 114 | - * @return bool Returns the former value of pool size. |
|
| 114 | + * @return boolean|null Returns the former value of pool size. |
|
| 115 | 115 | * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead. |
| 116 | 116 | */ |
| 117 | 117 | public function setPoolSize($size) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string $username A username used to identify the connection. |
| 127 | 127 | * @param string $password A password used to identify the connection. |
| 128 | 128 | * @throws MongoConnectionException |
| 129 | - * @return boolean If the connection was successful. |
|
| 129 | + * @return boolean|null If the connection was successful. |
|
| 130 | 130 | * @deprecated Pass array("persist" => $id) to the constructor instead of using this method. |
| 131 | 131 | */ |
| 132 | 132 | public function persistConnect($username = "", $password = "") |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param string $username A username used to identify the connection. |
| 142 | 142 | * @param string $password A password used to identify the connection. |
| 143 | 143 | * @throws MongoConnectionException |
| 144 | - * @return boolean If the connection was successful. |
|
| 144 | + * @return boolean|null If the connection was successful. |
|
| 145 | 145 | * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method. |
| 146 | 146 | */ |
| 147 | 147 | public function pairPersistConnect($username = "", $password = "") |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @link http://www.php.net/manual/en/mongo.connectutil.php |
| 156 | 156 | * @throws MongoConnectionException |
| 157 | - * @return boolean If the connection was successful. |
|
| 157 | + * @return boolean|null If the connection was successful. |
|
| 158 | 158 | */ |
| 159 | 159 | protected function connectUtil() |
| 160 | 160 | { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * Creates a database error on the database. |
| 202 | 202 | * |
| 203 | 203 | * @link http://www.php.net/manual/en/mongo.forceerror.php |
| 204 | - * @return boolean The database response. |
|
| 204 | + * @return boolean|null The database response. |
|
| 205 | 205 | * @deprecated Use MongoDB::forceError() instead. |
| 206 | 206 | */ |
| 207 | 207 | public function forceError() |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | * @param bool $ok |
| 102 | 102 | * @return bool returns the former value of slaveOkay for this instance. |
| 103 | 103 | */ |
| 104 | - public function setSlaveOkay ($ok) |
|
| 104 | + public function setSlaveOkay($ok) |
|
| 105 | 105 | { |
| 106 | 106 | $this->notImplemented(); |
| 107 | 107 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var MongoDB |
| 34 | 34 | */ |
| 35 | - public $db = NULL; |
|
| 35 | + public $db = null; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var string |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | foreach (func_get_args() as $operator) { |
| 134 | 134 | $i++; |
| 135 | 135 | if (! is_array($operator)) { |
| 136 | - trigger_error("Argument $i is not an array", E_WARNING); |
|
| 136 | + trigger_error("argument $i is not an array", E_WARNING); |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @param bool $scan_data Only validate indices, not the base collection. |
| 235 | 235 | * @return array Returns the database's evaluation of this object. |
| 236 | 236 | */ |
| 237 | - public function validate($scan_data = FALSE) |
|
| 237 | + public function validate($scan_data = false) |
|
| 238 | 238 | { |
| 239 | 239 | $command = [ |
| 240 | 240 | 'validate' => $this->name, |
@@ -511,6 +511,9 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | + /** |
|
| 515 | + * @param string $name |
|
| 516 | + */ |
|
| 514 | 517 | private function checkDatabaseName($name) |
| 515 | 518 | { |
| 516 | 519 | if (empty($name)) { |
@@ -543,7 +546,7 @@ discard block |
||
| 543 | 546 | } |
| 544 | 547 | |
| 545 | 548 | /** |
| 546 | - * @return array |
|
| 549 | + * @return string[] |
|
| 547 | 550 | */ |
| 548 | 551 | public function __sleep() |
| 549 | 552 | { |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function aggregate(array $pipeline, array $op = []) |
| 132 | 132 | { |
| 133 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
| 133 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
| 134 | 134 | $pipeline = []; |
| 135 | 135 | $options = []; |
| 136 | 136 | |
| 137 | 137 | $i = 0; |
| 138 | 138 | foreach (func_get_args() as $operator) { |
| 139 | 139 | $i++; |
| 140 | - if (! is_array($operator)) { |
|
| 140 | + if ( ! is_array($operator)) { |
|
| 141 | 141 | trigger_error("Argument $i is not an array", E_WARNING); |
| 142 | 142 | return; |
| 143 | 143 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | 'waitedMS' => 0, |
| 170 | 170 | ]; |
| 171 | 171 | } catch (\MongoDB\Driver\Exception\Exception $e) { |
| 172 | - throw ExceptionConverter::toLegacy($e,'MongoResultException'); |
|
| 172 | + throw ExceptionConverter::toLegacy($e, 'MongoResultException'); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | ]; |
| 191 | 191 | |
| 192 | 192 | // Convert cursor option |
| 193 | - if (! isset($options['cursor'])) { |
|
| 193 | + if ( ! isset($options['cursor'])) { |
|
| 194 | 194 | $options['cursor'] = new \stdClass(); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function insert(&$a, array $options = []) |
| 278 | 278 | { |
| 279 | - if (! $this->ensureDocumentHasMongoId($a)) { |
|
| 279 | + if ( ! $this->ensureDocumentHasMongoId($a)) { |
|
| 280 | 280 | trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING); |
| 281 | 281 | return; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if (! count((array)$a)) { |
|
| 284 | + if ( ! count((array) $a)) { |
|
| 285 | 285 | throw new \MongoException('document must be an array or object'); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | throw ExceptionConverter::toLegacy($e); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if (! $result->isAcknowledged()) { |
|
| 297 | + if ( ! $result->isAcknowledged()) { |
|
| 298 | 298 | return true; |
| 299 | 299 | } |
| 300 | 300 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | foreach ($a as $key => $item) { |
| 327 | 327 | try { |
| 328 | - if (! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 328 | + if ( ! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 329 | 329 | if ($continueOnError) { |
| 330 | 330 | unset($a[$key]); |
| 331 | 331 | } else { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | throw ExceptionConverter::toLegacy($e, 'MongoResultException'); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if (! $result->isAcknowledged()) { |
|
| 352 | + if ( ! $result->isAcknowledged()) { |
|
| 353 | 353 | return true; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @throws MongoCursorException |
| 374 | 374 | * @return boolean |
| 375 | 375 | */ |
| 376 | - public function update(array $criteria , array $newobj, array $options = []) |
|
| 376 | + public function update(array $criteria, array $newobj, array $options = []) |
|
| 377 | 377 | { |
| 378 | 378 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
| 379 | 379 | $isReplace = ! \MongoDB\is_first_key_operator($newobj); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | throw ExceptionConverter::toLegacy($e); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - if (! $result->isAcknowledged()) { |
|
| 400 | + if ( ! $result->isAcknowledged()) { |
|
| 401 | 401 | return true; |
| 402 | 402 | } |
| 403 | 403 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function remove(array $criteria = [], array $options = []) |
| 426 | 426 | { |
| 427 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
| 427 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
| 428 | 428 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 429 | 429 | |
| 430 | 430 | try { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | throw ExceptionConverter::toLegacy($e); |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - if (! $result->isAcknowledged()) { |
|
| 440 | + if ( ! $result->isAcknowledged()) { |
|
| 441 | 441 | return true; |
| 442 | 442 | } |
| 443 | 443 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | $options['projection'] = is_array($fields) ? TypeConverter::fromLegacy($fields) : []; |
| 511 | 511 | |
| 512 | - if (! \MongoDB\is_first_key_operator($update)) { |
|
| 512 | + if ( ! \MongoDB\is_first_key_operator($update)) { |
|
| 513 | 513 | $document = $this->collection->findOneAndReplace($query, $update, $options); |
| 514 | 514 | } else { |
| 515 | 515 | $document = $this->collection->findOneAndUpdate($query, $update, $options); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | public function findOne($query = [], array $fields = [], array $options = []) |
| 541 | 541 | { |
| 542 | 542 | // Can't typehint for array since MongoGridFS extends and accepts strings |
| 543 | - if (! is_array($query)) { |
|
| 543 | + if ( ! is_array($query)) { |
|
| 544 | 544 | trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', gettype($query)), E_WARNING); |
| 545 | 545 | return; |
| 546 | 546 | } |
@@ -580,11 +580,11 @@ discard block |
||
| 580 | 580 | $keys = (array) $keys; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - if (! is_array($keys) || ! count($keys)) { |
|
| 583 | + if ( ! is_array($keys) || ! count($keys)) { |
|
| 584 | 584 | throw new MongoException('index specification has no elements'); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - if (! isset($options['name'])) { |
|
| 587 | + if ( ! isset($options['name'])) { |
|
| 588 | 588 | $options['name'] = \MongoDB\generate_index_name($keys); |
| 589 | 589 | } |
| 590 | 590 | |
@@ -619,14 +619,14 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | $result = [ |
| 622 | - 'createdCollectionAutomatically' => !$collectionExists, |
|
| 622 | + 'createdCollectionAutomatically' => ! $collectionExists, |
|
| 623 | 623 | 'numIndexesBefore' => $indexCount, |
| 624 | 624 | 'numIndexesAfter' => $indexCount, |
| 625 | 625 | 'note' => 'all indexes already exist', |
| 626 | 626 | 'ok' => 1.0, |
| 627 | 627 | ]; |
| 628 | 628 | |
| 629 | - if (! $indexExists) { |
|
| 629 | + if ( ! $indexExists) { |
|
| 630 | 630 | $result['numIndexesAfter']++; |
| 631 | 631 | unset($result['note']); |
| 632 | 632 | } |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | { |
| 660 | 660 | if (is_string($keys)) { |
| 661 | 661 | $indexName = $keys; |
| 662 | - if (! preg_match('#_-?1$#', $indexName)) { |
|
| 662 | + if ( ! preg_match('#_-?1$#', $indexName)) { |
|
| 663 | 663 | $indexName .= '_1'; |
| 664 | 664 | } |
| 665 | 665 | } elseif (is_array($keys)) { |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $this->convertWriteConcernOptions($options) |
| 756 | 756 | ); |
| 757 | 757 | |
| 758 | - if (! $result->isAcknowledged()) { |
|
| 758 | + if ( ! $result->isAcknowledged()) { |
|
| 759 | 759 | return true; |
| 760 | 760 | } |
| 761 | 761 | |
@@ -789,13 +789,13 @@ discard block |
||
| 789 | 789 | if ($document_or_id instanceof \MongoId) { |
| 790 | 790 | $id = $document_or_id; |
| 791 | 791 | } elseif (is_object($document_or_id)) { |
| 792 | - if (! isset($document_or_id->_id)) { |
|
| 792 | + if ( ! isset($document_or_id->_id)) { |
|
| 793 | 793 | return null; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | $id = $document_or_id->_id; |
| 797 | 797 | } elseif (is_array($document_or_id)) { |
| 798 | - if (! isset($document_or_id['_id'])) { |
|
| 798 | + if ( ! isset($document_or_id['_id'])) { |
|
| 799 | 799 | return null; |
| 800 | 800 | } |
| 801 | 801 | |
@@ -838,14 +838,14 @@ discard block |
||
| 838 | 838 | $command = [ |
| 839 | 839 | 'group' => [ |
| 840 | 840 | 'ns' => $this->name, |
| 841 | - '$reduce' => (string)$reduce, |
|
| 841 | + '$reduce' => (string) $reduce, |
|
| 842 | 842 | 'initial' => $initial, |
| 843 | 843 | 'cond' => $condition, |
| 844 | 844 | ], |
| 845 | 845 | ]; |
| 846 | 846 | |
| 847 | 847 | if ($keys instanceof MongoCode) { |
| 848 | - $command['group']['$keyf'] = (string)$keys; |
|
| 848 | + $command['group']['$keyf'] = (string) $keys; |
|
| 849 | 849 | } else { |
| 850 | 850 | $command['group']['key'] = $keys; |
| 851 | 851 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | if (array_key_exists('finalize', $condition)) { |
| 856 | 856 | if ($condition['finalize'] instanceof MongoCode) { |
| 857 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 857 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 858 | 858 | } |
| 859 | 859 | $command['group']['finalize'] = $condition['finalize']; |
| 860 | 860 | } |
@@ -908,11 +908,11 @@ discard block |
||
| 908 | 908 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 911 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 912 | 912 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 915 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 916 | 916 | $collectionWriteConcern = $this->getWriteConcern(); |
| 917 | 917 | $writeConcern = $this->createWriteConcernFromParameters( |
| 918 | 918 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | }; |
| 946 | 946 | |
| 947 | 947 | if (is_array($document)) { |
| 948 | - if (! isset($document['_id'])) { |
|
| 948 | + if ( ! isset($document['_id'])) { |
|
| 949 | 949 | $document['_id'] = new \MongoId(); |
| 950 | 950 | } |
| 951 | 951 | |
@@ -955,12 +955,12 @@ discard block |
||
| 955 | 955 | } elseif (is_object($document)) { |
| 956 | 956 | $reflectionObject = new \ReflectionObject($document); |
| 957 | 957 | foreach ($reflectionObject->getProperties() as $property) { |
| 958 | - if (! $property->isPublic()) { |
|
| 958 | + if ( ! $property->isPublic()) { |
|
| 959 | 959 | throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?'); |
| 960 | 960 | } |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | - if (! isset($document->_id)) { |
|
| 963 | + if ( ! isset($document->_id)) { |
|
| 964 | 964 | $document->_id = new \MongoId(); |
| 965 | 965 | } |
| 966 | 966 | |
@@ -13,6 +13,7 @@ |
||
| 13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -class MongoConnectionException extends MongoException { |
|
| 16 | +class MongoConnectionException extends MongoException |
|
| 17 | +{ |
|
| 17 | 18 | |
| 18 | 19 | } |
@@ -13,6 +13,7 @@ |
||
| 13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -class MongoCursorException extends MongoException { |
|
| 16 | +class MongoCursorException extends MongoException |
|
| 17 | +{ |
|
| 17 | 18 | |
| 18 | 19 | } |