@@ -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 | } |
@@ -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 |
@@ -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 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
46 | - if (! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) { |
|
46 | + if ( ! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) { |
|
47 | 47 | throw new MongoException('invalid regex', 9); |
48 | 48 | } |
49 | 49 |
@@ -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,7 +170,7 @@ 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 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $this->convertWriteConcernOptions($options) |
263 | 263 | ); |
264 | 264 | |
265 | - if (! $result->isAcknowledged()) { |
|
265 | + if ( ! $result->isAcknowledged()) { |
|
266 | 266 | return true; |
267 | 267 | } |
268 | 268 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $this->convertWriteConcernOptions($options) |
291 | 291 | ); |
292 | 292 | |
293 | - if (! $result->isAcknowledged()) { |
|
293 | + if ( ! $result->isAcknowledged()) { |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @throws MongoCursorException |
315 | 315 | * @return boolean |
316 | 316 | */ |
317 | - public function update(array $criteria , array $newobj, array $options = []) |
|
317 | + public function update(array $criteria, array $newobj, array $options = []) |
|
318 | 318 | { |
319 | 319 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
320 | 320 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $this->convertWriteConcernOptions($options) |
328 | 328 | ); |
329 | 329 | |
330 | - if (! $result->isAcknowledged()) { |
|
330 | + if ( ! $result->isAcknowledged()) { |
|
331 | 331 | return true; |
332 | 332 | } |
333 | 333 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function remove(array $criteria = [], array $options = []) |
356 | 356 | { |
357 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : false; |
|
357 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : false; |
|
358 | 358 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
359 | 359 | |
360 | 360 | return $this->collection->$method($criteria, $options); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function find(array $query = [], array $fields = []) |
372 | 372 | { |
373 | - $cursor = new MongoCursor($this->db->getConnection(), (string)$this, $query, $fields); |
|
373 | + $cursor = new MongoCursor($this->db->getConnection(), (string) $this, $query, $fields); |
|
374 | 374 | $cursor->setReadPreference($this->getReadPreference()); |
375 | 375 | |
376 | 376 | return $cursor; |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | public function save($a, array $options = []) |
554 | 554 | { |
555 | 555 | if (is_object($a)) { |
556 | - $a = (array)$a; |
|
556 | + $a = (array) $a; |
|
557 | 557 | } |
558 | 558 | if ( ! array_key_exists('_id', $a)) { |
559 | 559 | $id = new \MongoId(); |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | $command = [ |
627 | 627 | 'group' => [ |
628 | 628 | 'ns' => $this->name, |
629 | - '$reduce' => (string)$reduce, |
|
629 | + '$reduce' => (string) $reduce, |
|
630 | 630 | 'initial' => $initial, |
631 | 631 | 'cond' => $condition, |
632 | 632 | ], |
633 | 633 | ]; |
634 | 634 | |
635 | 635 | if ($keys instanceof MongoCode) { |
636 | - $command['group']['$keyf'] = (string)$keys; |
|
636 | + $command['group']['$keyf'] = (string) $keys; |
|
637 | 637 | } else { |
638 | 638 | $command['group']['key'] = $keys; |
639 | 639 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | } |
643 | 643 | if (array_key_exists('finalize', $condition)) { |
644 | 644 | if ($condition['finalize'] instanceof MongoCode) { |
645 | - $condition['finalize'] = (string)$condition['finalize']; |
|
645 | + $condition['finalize'] = (string) $condition['finalize']; |
|
646 | 646 | } |
647 | 647 | $command['group']['finalize'] = $condition['finalize']; |
648 | 648 | } |
@@ -694,11 +694,11 @@ discard block |
||
694 | 694 | $options['w'] = ($options['safe']) ? 1 : 0; |
695 | 695 | } |
696 | 696 | |
697 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
697 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
698 | 698 | $options['wTimeoutMS'] = $options['wtimeout']; |
699 | 699 | } |
700 | 700 | |
701 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
701 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
702 | 702 | $collectionWriteConcern = $this->getWriteConcern(); |
703 | 703 | $writeConcern = $this->createWriteConcernFromParameters( |
704 | 704 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |