Completed
Pull Request — master (#162)
by Christian
04:15
created
lib/Mongo/MongoGridFS.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function findOne($query = [], array $fields = [], array $options = [])
133 133
     {
134
-        if (! is_array($query)) {
134
+        if ( ! is_array($query)) {
135 135
             $query = ['filename' => $query];
136 136
         }
137 137
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         try {
208 208
             $file = $this->insertFile($record, $options);
209 209
         } catch (MongoException $e) {
210
-            throw new MongoGridFSException('Could not store file: '. $e->getMessage(), 0, $e);
210
+            throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), 0, $e);
211 211
         }
212 212
 
213 213
         try {
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
             ];
245 245
 
246 246
             $handle = fopen($filename, 'r');
247
-            if (! $handle) {
247
+            if ( ! $handle) {
248 248
                 throw new MongoGridFSException('could not open file: ' . $filename);
249 249
             }
250
-        } elseif (! is_resource($filename)) {
250
+        } elseif ( ! is_resource($filename)) {
251 251
             throw new \Exception('first argument must be a string or stream resource');
252 252
         } else {
253 253
             $handle = $filename;
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 
271 271
         // Add length and MD5 if they were not present before
272 272
         $update = [];
273
-        if (! isset($record['length'])) {
273
+        if ( ! isset($record['length'])) {
274 274
             $update['length'] = $length;
275 275
         }
276
-        if (! isset($record['md5'])) {
276
+        if ( ! isset($record['md5'])) {
277 277
             try {
278 278
                 $update['md5'] = $md5;
279 279
             } catch (MongoException $e) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         if (count($update)) {
285 285
             try {
286 286
                 $result = $this->update(['_id' => $file['_id']], ['$set' => $update]);
287
-                if (! $this->isOKResult($result)) {
287
+                if ( ! $this->isOKResult($result)) {
288 288
                     throw new MongoGridFSException('Could not store file');
289 289
                 }
290 290
             } catch (MongoException $e) {
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function storeUpload($name, array $metadata = [])
310 310
     {
311
-        if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
311
+        if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
312 312
             throw new MongoGridFSException("Could not find uploaded file $name");
313 313
         }
314
-        if (! isset($_FILES[$name]['tmp_name'])) {
314
+        if ( ! isset($_FILES[$name]['tmp_name'])) {
315 315
             throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?");
316 316
         }
317 317
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
         $result = $this->chunks->insert($chunk);
363 363
 
364
-        if (! $this->isOKResult($result)) {
364
+        if ( ! $this->isOKResult($result)) {
365 365
             throw new \MongoException('error inserting chunk');
366 366
         }
367 367
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
         $hash = hash_init('md5');
407 407
 
408 408
         rewind($handle);
409
-        while (! feof($handle)) {
409
+        while ( ! feof($handle)) {
410 410
             $data = stream_get_contents($handle, $chunkSize);
411 411
             hash_update($hash, $data);
412 412
             $this->insertChunk($fileId, $data, $i++);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
         $result = $this->insert($record, $options);
438 438
 
439
-        if (! $this->isOKResult($result)) {
439
+        if ( ! $this->isOKResult($result)) {
440 440
             throw new \MongoException('error inserting file');
441 441
         }
442 442
 
Please login to merge, or discard this patch.