@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function aggregate(array $pipeline, array $op = []) |
133 | 133 | { |
134 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
134 | + if (!TypeConverter::isNumericArray($pipeline)) { |
|
135 | 135 | $pipeline = []; |
136 | 136 | $options = []; |
137 | 137 | |
138 | 138 | $i = 0; |
139 | 139 | foreach (func_get_args() as $operator) { |
140 | 140 | $i++; |
141 | - if (! is_array($operator)) { |
|
141 | + if (!is_array($operator)) { |
|
142 | 142 | trigger_error("Argument $i is not an array", E_WARNING); |
143 | 143 | return; |
144 | 144 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ]; |
175 | 175 | |
176 | 176 | // Convert cursor option |
177 | - if (! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
177 | + if (!isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
178 | 178 | // Cursor option needs to be an object convert bools and empty arrays since those won't be handled by TypeConverter |
179 | 179 | $options['cursor'] = new \stdClass; |
180 | 180 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @throws MongoCursorException |
361 | 361 | * @return boolean |
362 | 362 | */ |
363 | - public function update(array $criteria , array $newobj, array $options = array()) |
|
363 | + public function update(array $criteria, array $newobj, array $options = array()) |
|
364 | 364 | { |
365 | 365 | $multiple = ($options['multiple']) ? $options['multiple'] : false; |
366 | 366 | // $multiple = $options['multiple'] ?? false; |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | public function save($a, array $options = array()) |
602 | 602 | { |
603 | 603 | if (is_object($a)) { |
604 | - $a = (array)$a; |
|
604 | + $a = (array) $a; |
|
605 | 605 | } |
606 | - if ( ! array_key_exists('_id', $a)) { |
|
606 | + if (!array_key_exists('_id', $a)) { |
|
607 | 607 | $id = new \MongoId(); |
608 | 608 | } else { |
609 | 609 | $id = $a['_id']; |
@@ -665,20 +665,20 @@ discard block |
||
665 | 665 | if (is_string($reduce)) { |
666 | 666 | $reduce = new MongoCode($reduce); |
667 | 667 | } |
668 | - if ( ! $reduce instanceof MongoCode) { |
|
668 | + if (!$reduce instanceof MongoCode) { |
|
669 | 669 | throw new \InvalidArgumentExcption('reduce parameter should be a string or MongoCode instance.'); |
670 | 670 | } |
671 | 671 | $command = [ |
672 | 672 | 'group' => [ |
673 | 673 | 'ns' => $this->name, |
674 | - '$reduce' => (string)$reduce, |
|
674 | + '$reduce' => (string) $reduce, |
|
675 | 675 | 'initial' => $initial, |
676 | 676 | 'cond' => $condition, |
677 | 677 | ], |
678 | 678 | ]; |
679 | 679 | |
680 | 680 | if ($keys instanceof MongoCode) { |
681 | - $command['group']['$keyf'] = (string)$keys; |
|
681 | + $command['group']['$keyf'] = (string) $keys; |
|
682 | 682 | } else { |
683 | 683 | $command['group']['key'] = $keys; |
684 | 684 | } |
@@ -687,14 +687,14 @@ discard block |
||
687 | 687 | } |
688 | 688 | if (array_key_exists('finalize', $condition)) { |
689 | 689 | if ($condition['finalize'] instanceof MongoCode) { |
690 | - $condition['finalize'] = (string)$condition['finalize']; |
|
690 | + $condition['finalize'] = (string) $condition['finalize']; |
|
691 | 691 | } |
692 | 692 | $command['group']['finalize'] = $condition['finalize']; |
693 | 693 | } |
694 | 694 | |
695 | 695 | $result = $this->db->command($command, [], $hash); |
696 | 696 | unset($result['waitedMS']); |
697 | - $result['ok'] = (int)$result['ok']; |
|
697 | + $result['ok'] = (int) $result['ok']; |
|
698 | 698 | if (count($result['retval'])) { |
699 | 699 | $result['retval'] = current($result['retval']); |
700 | 700 | } |
@@ -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 |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $results[$key] = [ |
196 | 196 | 'host' => $server->getHost(), |
197 | 197 | 'port' => $server->getPort(), |
198 | - 'health' => (int)$info['ok'], // Not totally sure about this |
|
198 | + 'health' => (int) $info['ok'], // Not totally sure about this |
|
199 | 199 | 'state' => $server->getType(), |
200 | 200 | 'ping' => $server->getLatency(), |
201 | 201 | 'lastPing' => null, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32 |
236 | 236 | * bit platforms (and Windows). |
237 | 237 | */ |
238 | - public function killCursor($server_hash , $id) |
|
238 | + public function killCursor($server_hash, $id) |
|
239 | 239 | { |
240 | 240 | throw new \Exception('Not implemented'); |
241 | 241 | } |