@@ -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, |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @link http://www.php.net/manual/en/mongocollection.aggregate.php |
| 123 | 123 | * @param array $pipeline |
| 124 | 124 | * @param array $op |
| 125 | - * @return array |
|
| 125 | + * @return null|Traversable |
|
| 126 | 126 | */ |
| 127 | 127 | public function aggregate(array $pipeline, array $op = []) |
| 128 | 128 | { |
@@ -955,6 +955,9 @@ discard block |
||
| 955 | 955 | return null; |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | + /** |
|
| 959 | + * @param string $name |
|
| 960 | + */ |
|
| 958 | 961 | private function checkCollectionName($name) |
| 959 | 962 | { |
| 960 | 963 | if (empty($name)) { |
@@ -965,7 +968,7 @@ discard block |
||
| 965 | 968 | } |
| 966 | 969 | |
| 967 | 970 | /** |
| 968 | - * @return array |
|
| 971 | + * @return string[] |
|
| 969 | 972 | */ |
| 970 | 973 | public function __sleep() |
| 971 | 974 | { |
@@ -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); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | public function findOne($query = [], array $fields = [], array $options = []) |
| 531 | 531 | { |
| 532 | 532 | // Can't typehint for array since MongoGridFS extends and accepts strings |
| 533 | - if (! is_array($query)) { |
|
| 533 | + if ( ! is_array($query)) { |
|
| 534 | 534 | trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', gettype($query)), E_WARNING); |
| 535 | 535 | return; |
| 536 | 536 | } |
@@ -570,11 +570,11 @@ discard block |
||
| 570 | 570 | $keys = (array) $keys; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if (! is_array($keys) || ! count($keys)) { |
|
| 573 | + if ( ! is_array($keys) || ! count($keys)) { |
|
| 574 | 574 | throw new MongoException('index specification has no elements'); |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - if (! isset($options['name'])) { |
|
| 577 | + if ( ! isset($options['name'])) { |
|
| 578 | 578 | $options['name'] = \MongoDB\generate_index_name($keys); |
| 579 | 579 | } |
| 580 | 580 | |
@@ -609,14 +609,14 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | $result = [ |
| 612 | - 'createdCollectionAutomatically' => !$collectionExists, |
|
| 612 | + 'createdCollectionAutomatically' => ! $collectionExists, |
|
| 613 | 613 | 'numIndexesBefore' => $indexCount, |
| 614 | 614 | 'numIndexesAfter' => $indexCount, |
| 615 | 615 | 'note' => 'all indexes already exist', |
| 616 | 616 | 'ok' => 1.0, |
| 617 | 617 | ]; |
| 618 | 618 | |
| 619 | - if (! $indexExists) { |
|
| 619 | + if ( ! $indexExists) { |
|
| 620 | 620 | $result['numIndexesAfter']++; |
| 621 | 621 | unset($result['note']); |
| 622 | 622 | } |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | { |
| 650 | 650 | if (is_string($keys)) { |
| 651 | 651 | $indexName = $keys; |
| 652 | - if (! preg_match('#_-?1$#', $indexName)) { |
|
| 652 | + if ( ! preg_match('#_-?1$#', $indexName)) { |
|
| 653 | 653 | $indexName .= '_1'; |
| 654 | 654 | } |
| 655 | 655 | } elseif (is_array($keys)) { |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | $this->convertWriteConcernOptions($options) |
| 746 | 746 | ); |
| 747 | 747 | |
| 748 | - if (! $result->isAcknowledged()) { |
|
| 748 | + if ( ! $result->isAcknowledged()) { |
|
| 749 | 749 | return true; |
| 750 | 750 | } |
| 751 | 751 | |
@@ -779,13 +779,13 @@ discard block |
||
| 779 | 779 | if ($document_or_id instanceof \MongoId) { |
| 780 | 780 | $id = $document_or_id; |
| 781 | 781 | } elseif (is_object($document_or_id)) { |
| 782 | - if (! isset($document_or_id->_id)) { |
|
| 782 | + if ( ! isset($document_or_id->_id)) { |
|
| 783 | 783 | return null; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | $id = $document_or_id->_id; |
| 787 | 787 | } elseif (is_array($document_or_id)) { |
| 788 | - if (! isset($document_or_id['_id'])) { |
|
| 788 | + if ( ! isset($document_or_id['_id'])) { |
|
| 789 | 789 | return null; |
| 790 | 790 | } |
| 791 | 791 | |
@@ -828,14 +828,14 @@ discard block |
||
| 828 | 828 | $command = [ |
| 829 | 829 | 'group' => [ |
| 830 | 830 | 'ns' => $this->name, |
| 831 | - '$reduce' => (string)$reduce, |
|
| 831 | + '$reduce' => (string) $reduce, |
|
| 832 | 832 | 'initial' => $initial, |
| 833 | 833 | 'cond' => $condition, |
| 834 | 834 | ], |
| 835 | 835 | ]; |
| 836 | 836 | |
| 837 | 837 | if ($keys instanceof MongoCode) { |
| 838 | - $command['group']['$keyf'] = (string)$keys; |
|
| 838 | + $command['group']['$keyf'] = (string) $keys; |
|
| 839 | 839 | } else { |
| 840 | 840 | $command['group']['key'] = $keys; |
| 841 | 841 | } |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | } |
| 845 | 845 | if (array_key_exists('finalize', $condition)) { |
| 846 | 846 | if ($condition['finalize'] instanceof MongoCode) { |
| 847 | - $condition['finalize'] = (string)$condition['finalize']; |
|
| 847 | + $condition['finalize'] = (string) $condition['finalize']; |
|
| 848 | 848 | } |
| 849 | 849 | $command['group']['finalize'] = $condition['finalize']; |
| 850 | 850 | } |
@@ -898,11 +898,11 @@ discard block |
||
| 898 | 898 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 901 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 902 | 902 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 905 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 906 | 906 | $collectionWriteConcern = $this->getWriteConcern(); |
| 907 | 907 | $writeConcern = $this->createWriteConcernFromParameters( |
| 908 | 908 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | }; |
| 936 | 936 | |
| 937 | 937 | if (is_array($document)) { |
| 938 | - if (! isset($document['_id'])) { |
|
| 938 | + if ( ! isset($document['_id'])) { |
|
| 939 | 939 | $document['_id'] = new \MongoId(); |
| 940 | 940 | } |
| 941 | 941 | |
@@ -945,12 +945,12 @@ discard block |
||
| 945 | 945 | } elseif (is_object($document)) { |
| 946 | 946 | $reflectionObject = new \ReflectionObject($document); |
| 947 | 947 | foreach ($reflectionObject->getProperties() as $property) { |
| 948 | - if (! $property->isPublic()) { |
|
| 948 | + if ( ! $property->isPublic()) { |
|
| 949 | 949 | throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?'); |
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - if (! isset($document->_id)) { |
|
| 953 | + if ( ! isset($document->_id)) { |
|
| 954 | 954 | $document->_id = new \MongoId(); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -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 | } |