Completed
Pull Request — master (#28)
by Andreas
03:44
created
lib/Mongo/MongoWriteBatch.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function add($item)
77 77
     {
78 78
         if (is_object($item)) {
79
-            $item = (array)$item;
79
+            $item = (array) $item;
80 80
         }
81 81
 
82 82
         $this->validate($item);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     final public function execute(array $writeOptions = [])
96 96
     {
97 97
         $writeOptions += $this->writeOptions;
98
-        if (! count($this->items)) {
98
+        if ( ! count($this->items)) {
99 99
             return ['ok' => true];
100 100
         }
101 101
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
     {
143 143
         switch ($this->batchType) {
144 144
             case self::COMMAND_UPDATE:
145
-                if (! isset($item['q']) || ! isset($item['u'])) {
145
+                if ( ! isset($item['q']) || ! isset($item['u'])) {
146 146
                     throw new Exception('invalid item');
147 147
                 }
148 148
                 break;
149 149
 
150 150
             case self::COMMAND_DELETE:
151
-                if (! isset($item['q']) || ! isset($item['limit'])) {
151
+                if ( ! isset($item['q']) || ! isset($item['limit'])) {
152 152
                     throw new Exception('invalid item');
153 153
                 }
154 154
                 break;
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/Helper/WriteConcernConverter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Mongo/MongoCollection.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
170 170
         ];
171 171
 
172 172
         // Convert cursor option
173
-        if (! isset($options['cursor'])) {
173
+        if ( ! isset($options['cursor'])) {
174 174
             $options['cursor'] = true;
175 175
         }
176 176
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function insert(&$a, array $options = [])
258 258
     {
259
-        if (! $this->ensureDocumentHasMongoId($a)) {
259
+        if ( ! $this->ensureDocumentHasMongoId($a)) {
260 260
             trigger_error(sprintf('%s expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_WARNING);
261 261
             return;
262 262
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $this->convertWriteConcernOptions($options)
267 267
         );
268 268
 
269
-        if (! $result->isAcknowledged()) {
269
+        if ( ! $result->isAcknowledged()) {
270 270
             return true;
271 271
         }
272 272
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $this->convertWriteConcernOptions($options)
299 299
         );
300 300
 
301
-        if (! $result->isAcknowledged()) {
301
+        if ( ! $result->isAcknowledged()) {
302 302
             return true;
303 303
         }
304 304
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @throws MongoCursorException
323 323
      * @return boolean
324 324
      */
325
-    public function update(array $criteria , array $newobj, array $options = [])
325
+    public function update(array $criteria, array $newobj, array $options = [])
326 326
     {
327 327
         $multiple = isset($options['multiple']) ? $options['multiple'] : false;
328 328
         $method = $multiple ? 'updateMany' : 'updateOne';
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->convertWriteConcernOptions($options)
336 336
         );
337 337
 
338
-        if (! $result->isAcknowledged()) {
338
+        if ( ! $result->isAcknowledged()) {
339 339
             return true;
340 340
         }
341 341
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function remove(array $criteria = [], array $options = [])
364 364
     {
365
-        $multiple = isset($options['justOne']) ? !$options['justOne'] : true;
365
+        $multiple = isset($options['justOne']) ? ! $options['justOne'] : true;
366 366
         $method = $multiple ? 'deleteMany' : 'deleteOne';
367 367
 
368 368
         /** @var \MongoDB\DeleteResult $result */
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             $this->convertWriteConcernOptions($options)
372 372
         );
373 373
 
374
-        if (! $result->isAcknowledged()) {
374
+        if ( ! $result->isAcknowledged()) {
375 375
             return true;
376 376
         }
377 377
 
@@ -609,13 +609,13 @@  discard block
 block discarded – undo
609 609
         if ($document_or_id instanceof \MongoId) {
610 610
             $id = $document_or_id;
611 611
         } elseif (is_object($document_or_id)) {
612
-            if (! isset($document_or_id->_id)) {
612
+            if ( ! isset($document_or_id->_id)) {
613 613
                 return null;
614 614
             }
615 615
 
616 616
             $id = $document_or_id->_id;
617 617
         } elseif (is_array($document_or_id)) {
618
-            if (! isset($document_or_id['_id'])) {
618
+            if ( ! isset($document_or_id['_id'])) {
619 619
                 return null;
620 620
             }
621 621
 
@@ -658,14 +658,14 @@  discard block
 block discarded – undo
658 658
         $command = [
659 659
             'group' => [
660 660
                 'ns' => $this->name,
661
-                '$reduce' => (string)$reduce,
661
+                '$reduce' => (string) $reduce,
662 662
                 'initial' => $initial,
663 663
                 'cond' => $condition,
664 664
             ],
665 665
         ];
666 666
 
667 667
         if ($keys instanceof MongoCode) {
668
-            $command['group']['$keyf'] = (string)$keys;
668
+            $command['group']['$keyf'] = (string) $keys;
669 669
         } else {
670 670
             $command['group']['key'] = $keys;
671 671
         }
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         }
675 675
         if (array_key_exists('finalize', $condition)) {
676 676
             if ($condition['finalize'] instanceof MongoCode) {
677
-                $condition['finalize'] = (string)$condition['finalize'];
677
+                $condition['finalize'] = (string) $condition['finalize'];
678 678
             }
679 679
             $command['group']['finalize'] = $condition['finalize'];
680 680
         }
@@ -728,11 +728,11 @@  discard block
 block discarded – undo
728 728
             $options['w'] = ($options['safe']) ? 1 : 0;
729 729
         }
730 730
 
731
-        if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) {
731
+        if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) {
732 732
             $options['wTimeoutMS'] = $options['wtimeout'];
733 733
         }
734 734
 
735
-        if (isset($options['w']) || !isset($options['wTimeoutMS'])) {
735
+        if (isset($options['w']) || ! isset($options['wTimeoutMS'])) {
736 736
             $collectionWriteConcern = $this->getWriteConcern();
737 737
             $writeConcern = $this->createWriteConcernFromParameters(
738 738
                 isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'],
@@ -757,13 +757,13 @@  discard block
 block discarded – undo
757 757
     private function ensureDocumentHasMongoId(&$document)
758 758
     {
759 759
         if (is_array($document)) {
760
-            if (! isset($document['_id'])) {
760
+            if ( ! isset($document['_id'])) {
761 761
                 $document['_id'] = new \MongoId();
762 762
             }
763 763
 
764 764
             return $document['_id'];
765 765
         } elseif (is_object($document)) {
766
-            if (! isset($document->_id)) {
766
+            if ( ! isset($document->_id)) {
767 767
                 $document->_id = new \MongoId();
768 768
             }
769 769
 
Please login to merge, or discard this patch.
lib/Mongo/functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 use Alcaeus\MongoDbAdapter\TypeConverter;
17 17
 
18
-if (! function_exists('bson_decode')) {
18
+if ( ! function_exists('bson_decode')) {
19 19
     /**
20 20
      * Deserializes a BSON object into a PHP array
21 21
      *
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('bson_encode')) {
31
+if ( ! function_exists('bson_encode')) {
32 32
     /**
33 33
      * Serializes a PHP variable into a BSON string
34 34
      *
Please login to merge, or discard this patch.