Completed
Pull Request — master (#167)
by Emir
03:22
created
lib/Mongo/MongoDBRef.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Mongo/MongoRegex.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Mongo/MongoGridFSCursor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,6 +65,6 @@
 block discarded – undo
65 65
     public function key()
66 66
     {
67 67
         $file = $this->current();
68
-        return ($file !== null) ? (string)$file->file['_id'] : null;
68
+        return ($file !== null) ? (string) $file->file['_id'] : null;
69 69
     }
70 70
 }
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.
lib/Mongo/MongoGridFS.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function findOne($query = [], array $fields = [], array $options = [])
129 129
     {
130
-        if (! is_array($query)) {
130
+        if ( ! is_array($query)) {
131 131
             $query = ['filename' => (string) $query];
132 132
         }
133 133
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         try {
204 204
             $file = $this->insertFile($record, $options);
205 205
         } catch (MongoException $e) {
206
-            throw new MongoGridFSException('Could not store file: '. $e->getMessage(), 0, $e);
206
+            throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), 0, $e);
207 207
         }
208 208
 
209 209
         try {
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
             ];
241 241
 
242 242
             $handle = fopen($filename, 'r');
243
-            if (! $handle) {
243
+            if ( ! $handle) {
244 244
                 throw new MongoGridFSException('could not open file: ' . $filename);
245 245
             }
246
-        } elseif (! is_resource($filename)) {
246
+        } elseif ( ! is_resource($filename)) {
247 247
             throw new \Exception('first argument must be a string or stream resource');
248 248
         } else {
249 249
             $handle = $filename;
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 
267 267
         // Add length and MD5 if they were not present before
268 268
         $update = [];
269
-        if (! isset($record['length'])) {
269
+        if ( ! isset($record['length'])) {
270 270
             $update['length'] = $length;
271 271
         }
272
-        if (! isset($record['md5'])) {
272
+        if ( ! isset($record['md5'])) {
273 273
             try {
274 274
                 $update['md5'] = $md5;
275 275
             } catch (MongoException $e) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         if (count($update)) {
281 281
             try {
282 282
                 $result = $this->update(['_id' => $file['_id']], ['$set' => $update]);
283
-                if (! $this->isOKResult($result)) {
283
+                if ( ! $this->isOKResult($result)) {
284 284
                     throw new MongoGridFSException('Could not store file');
285 285
                 }
286 286
             } catch (MongoException $e) {
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function storeUpload($name, array $metadata = [])
306 306
     {
307
-        if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
307
+        if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
308 308
             throw new MongoGridFSException("Could not find uploaded file $name");
309 309
         }
310
-        if (! isset($_FILES[$name]['tmp_name'])) {
310
+        if ( ! isset($_FILES[$name]['tmp_name'])) {
311 311
             throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?");
312 312
         }
313 313
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
         $result = $this->chunks->insert($chunk);
359 359
 
360
-        if (! $this->isOKResult($result)) {
360
+        if ( ! $this->isOKResult($result)) {
361 361
             throw new \MongoException('error inserting chunk');
362 362
         }
363 363
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         $hash = hash_init('md5');
403 403
 
404 404
         rewind($handle);
405
-        while (! feof($handle)) {
405
+        while ( ! feof($handle)) {
406 406
             $data = stream_get_contents($handle, $chunkSize);
407 407
             hash_update($hash, $data);
408 408
             $this->insertChunk($fileId, $data, $i++);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
         $result = $this->insert($record, $options);
434 434
 
435
-        if (! $this->isOKResult($result)) {
435
+        if ( ! $this->isOKResult($result)) {
436 436
             throw new \MongoException('error inserting file');
437 437
         }
438 438
 
Please login to merge, or discard this patch.
lib/Mongo/MongoId.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Mongo/MongoCursor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function hasNext()
223 223
     {
224
-        if (! $this->startedIterating) {
224
+        if ( ! $this->startedIterating) {
225 225
             $this->ensureIterator();
226 226
             $this->startedIterating = true;
227 227
             $this->storeIteratorState();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      */
406 406
     protected function convertCursorType()
407 407
     {
408
-        if (! $this->tailable) {
408
+        if ( ! $this->tailable) {
409 409
             return null;
410 410
         }
411 411
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     protected function wrapTraversable(\Traversable $traversable)
447 447
     {
448 448
         foreach ($traversable as $key => $value) {
449
-            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || !is_object($value->_id))) {
449
+            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || ! is_object($value->_id))) {
450 450
                 $key = (string) $value->_id;
451 451
             }
452 452
             yield $key => $value;
Please login to merge, or discard this patch.
lib/Mongo/MongoWriteBatch.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function add($item)
84 84
     {
85 85
         if (is_object($item)) {
86
-            $item = (array)$item;
86
+            $item = (array) $item;
87 87
         }
88 88
 
89 89
         $this->validate($item);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     final public function execute(array $writeOptions = [])
103 103
     {
104 104
         $writeOptions += $this->writeOptions;
105
-        if (! count($this->items)) {
105
+        if ( ! count($this->items)) {
106 106
             return ['ok' => true];
107 107
         }
108 108
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 break;
168 168
         }
169 169
 
170
-        if (! $ok) {
170
+        if ( ! $ok) {
171 171
             // Exception code is hardcoded to the value in ext-mongo, see
172 172
             // https://github.com/mongodb/mongo-php-driver-legacy/blob/ab4bc0d90e93b3f247f6bcb386d0abc8d2fa7d74/batch/write.c#L428
173 173
             throw new \MongoWriteConcernException('Failed write', 911, null, $resultDocument);
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
     {
181 181
         switch ($this->batchType) {
182 182
             case self::COMMAND_UPDATE:
183
-                if (! isset($item['q'])) {
183
+                if ( ! isset($item['q'])) {
184 184
                     throw new Exception("Expected \$item to contain 'q' key");
185 185
                 }
186
-                if (! isset($item['u'])) {
186
+                if ( ! isset($item['u'])) {
187 187
                     throw new Exception("Expected \$item to contain 'u' key");
188 188
                 }
189 189
                 break;
190 190
 
191 191
             case self::COMMAND_DELETE:
192
-                if (! isset($item['q'])) {
192
+                if ( ! isset($item['q'])) {
193 193
                     throw new Exception("Expected \$item to contain 'q' key");
194 194
                 }
195
-                if (! isset($item['limit'])) {
195
+                if ( ! isset($item['limit'])) {
196 196
                     throw new Exception("Expected \$item to contain 'limit' key");
197 197
                 }
198 198
                 break;
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/TypeConverter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,16 +103,16 @@
 block discarded – undo
103 103
      */
104 104
     public static function convertProjection($fields)
105 105
     {
106
-        if (! is_array($fields) || $fields === []) {
106
+        if ( ! is_array($fields) || $fields === []) {
107 107
             return [];
108 108
         }
109 109
 
110
-        if (! TypeConverter::isNumericArray($fields)) {
110
+        if ( ! TypeConverter::isNumericArray($fields)) {
111 111
             $projection = TypeConverter::fromLegacy($fields);
112 112
         } else {
113 113
             $projection = array_fill_keys(
114
-                array_map(function ($field) {
115
-                    if (!is_string($field)) {
114
+                array_map(function($field) {
115
+                    if ( ! is_string($field)) {
116 116
                         throw new \MongoException('field names must be strings', 8);
117 117
                     }
118 118
 
Please login to merge, or discard this patch.