@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | class MongoClient |
| 24 | 24 | { |
| 25 | 25 | const VERSION = '1.6.12'; |
| 26 | - const DEFAULT_HOST = "localhost" ; |
|
| 27 | - const DEFAULT_PORT = 27017 ; |
|
| 28 | - const RP_PRIMARY = "primary" ; |
|
| 29 | - const RP_PRIMARY_PREFERRED = "primaryPreferred" ; |
|
| 30 | - const RP_SECONDARY = "secondary" ; |
|
| 31 | - const RP_SECONDARY_PREFERRED = "secondaryPreferred" ; |
|
| 32 | - const RP_NEAREST = "nearest" ; |
|
| 26 | + const DEFAULT_HOST = "localhost"; |
|
| 27 | + const DEFAULT_PORT = 27017; |
|
| 28 | + const RP_PRIMARY = "primary"; |
|
| 29 | + const RP_PRIMARY_PREFERRED = "primaryPreferred"; |
|
| 30 | + const RP_SECONDARY = "secondary"; |
|
| 31 | + const RP_SECONDARY_PREFERRED = "secondaryPreferred"; |
|
| 32 | + const RP_NEAREST = "nearest"; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @var bool |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32 |
| 199 | 199 | * bit platforms (and Windows). |
| 200 | 200 | */ |
| 201 | - public function killCursor($server_hash , $id) |
|
| 201 | + public function killCursor($server_hash, $id) |
|
| 202 | 202 | { |
| 203 | 203 | |
| 204 | 204 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | * <ul> |
| 100 | 100 | * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure. |
| 101 | 101 | */ |
| 102 | - public static function setCallback ( callable $log_function ) {} |
|
| 102 | + public static function setCallback(callable $log_function) {} |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * This function can be used to set how verbose logging should be and the types of |
@@ -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 | |
@@ -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 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | protected function setWriteConcernFromParameters($wstring, $wtimeout = 0) |
| 57 | 57 | { |
| 58 | - if (! is_string($wstring) && ! is_int($wstring)) { |
|
| 58 | + if ( ! is_string($wstring) && ! is_int($wstring)) { |
|
| 59 | 59 | trigger_error("w for WriteConcern must be a string or integer", E_WARNING); |
| 60 | 60 | return false; |
| 61 | 61 | } |
@@ -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'; |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function remove(array $criteria = [], array $options = []) |
| 307 | 307 | { |
| 308 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : false; |
|
| 308 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : false; |
|
| 309 | 309 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 310 | 310 | |
| 311 | 311 | return $this->collection->$method($criteria, $options); |
@@ -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,7 +504,7 @@ 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 | 509 | if ( ! array_key_exists('_id', $a)) { |
| 510 | 510 | $id = new \MongoId(); |
@@ -577,14 +577,14 @@ discard block |
||
| 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 | } |
@@ -380,7 +380,7 @@ |
||
| 380 | 380 | */ |
| 381 | 381 | protected function convertCursorType() |
| 382 | 382 | { |
| 383 | - if (! $this->tailable) { |
|
| 383 | + if ( ! $this->tailable) { |
|
| 384 | 384 | return null; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $collections = $this->db->listCollections($options); |
| 132 | 132 | |
| 133 | - $getCollectionName = function (CollectionInfo $collectionInfo) { |
|
| 133 | + $getCollectionName = function(CollectionInfo $collectionInfo) { |
|
| 134 | 134 | return $collectionInfo->getName(); |
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | - return array_map($getCollectionName, (array)$collections); |
|
| 137 | + return array_map($getCollectionName, (array) $collections); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -279,13 +279,13 @@ discard block |
||
| 279 | 279 | if ($document_or_id instanceof \MongoId) { |
| 280 | 280 | $id = $document_or_id; |
| 281 | 281 | } elseif (is_object($document_or_id)) { |
| 282 | - if (! isset($document_or_id->_id)) { |
|
| 282 | + if ( ! isset($document_or_id->_id)) { |
|
| 283 | 283 | return null; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $id = $document_or_id->_id; |
| 287 | 287 | } elseif (is_array($document_or_id)) { |
| 288 | - if (! isset($document_or_id['_id'])) { |
|
| 288 | + if ( ! isset($document_or_id['_id'])) { |
|
| 289 | 289 | return null; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | */ |
| 78 | 78 | public static function get($db, $ref) |
| 79 | 79 | { |
| 80 | - if (! static::isRef($ref)) { |
|
| 80 | + if ( ! static::isRef($ref)) { |
|
| 81 | 81 | return null; |
| 82 | 82 | } |
| 83 | 83 | |