Test Failed
Push — master ( 8c814b...380005 )
by Raffael
08:49
created
src/lib/Filesystem/Node/File.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@
 block discarded – undo
45 45
      * @param array
46 46
      **/
47 47
     protected $temp_files = [
48
-        '/^\._(.*)$/',     // OS/X resource forks
49
-        '/^.DS_Store$/',   // OS/X custom folder settings
48
+        '/^\._(.*)$/', // OS/X resource forks
49
+        '/^.DS_Store$/', // OS/X custom folder settings
50 50
         '/^desktop.ini$/', // Windows custom folder settings
51
-        '/^Thumbs.db$/',   // Windows thumbnail cache
52
-        '/^.(.*).swpx$/',  // ViM temporary files
53
-        '/^.(.*).swx$/',   // ViM temporary files
54
-        '/^.(.*).swp$/',   // ViM temporary files
55
-        '/^\.dat(.*)$/',   // Smultron seems to create these
51
+        '/^Thumbs.db$/', // Windows thumbnail cache
52
+        '/^.(.*).swpx$/', // ViM temporary files
53
+        '/^.(.*).swx$/', // ViM temporary files
54
+        '/^.(.*).swp$/', // ViM temporary files
55
+        '/^\.dat(.*)$/', // Smultron seems to create these
56 56
         '/^~lock.(.*)#$/', // Windows 7 lockfiles
57 57
     ];
58 58
 
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Constructor/Http.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             ->prependRoute(new Route('/api/v2/nodes|files|collections/subscription(/|\z)', v2\Subscription::class))
33 33
             ->prependRoute(new Route('/api/v2/nodes|files|collections/{id:#([0-9a-z]{24})#}/subscription(/|\z)', v2\Subscription::class));
34 34
 
35
-        $decorator->addDecorator('subscription', function ($node) use ($notifier, $server) {
35
+        $decorator->addDecorator('subscription', function($node) use ($notifier, $server) {
36 36
             $subscription = $notifier->getSubscription($node, $server->getIdentity());
37 37
             if ($subscription === null) {
38 38
                 return false;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             return true;
42 42
         });
43 43
 
44
-        $decorator->addDecorator('subscription_exclude_me', function ($node) use ($notifier, $server) {
44
+        $decorator->addDecorator('subscription_exclude_me', function($node) use ($notifier, $server) {
45 45
             $subscription = $notifier->getSubscription($node, $server->getIdentity());
46 46
             if ($subscription === null) {
47 47
                 return false;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return $subscription['exclude_me'];
51 51
         });
52 52
 
53
-        $decorator->addDecorator('subscription_recursive', function ($node) use ($notifier, $server) {
53
+        $decorator->addDecorator('subscription_recursive', function($node) use ($notifier, $server) {
54 54
             if (!($node instanceof Collection)) {
55 55
                 return null;
56 56
             }
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/AttributeDecorator/NodeDecorator.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
      * Add decorator.
87 87
      *
88 88
      *
89
-     * @return AttributeDecorator
89
+     * @return NodeDecorator
90 90
      */
91 91
     public function addDecorator(string $attribute, Closure $decorator): self
92 92
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/AttributeDecorator/RoleDecorator.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      * Add decorator.
74 74
      *
75 75
      *
76
-     * @return AttributeDecorator
76
+     * @return RoleDecorator
77 77
      */
78 78
     public function addDecorator(string $attribute, Closure $decorator): self
79 79
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/Node.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             }
184 184
         }
185 185
 
186
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) {
186
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) {
187 187
             if (true === $move) {
188 188
                 $node = $node->setParent($parent, $conflict);
189 189
             }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
         $node = $this->_getNode($id, $p);
262 262
         if ($node instanceof Collection) {
263
-            return (new Response())->setBody(function () use ($node) {
263
+            return (new Response())->setBody(function() use ($node) {
264 264
                 $node->getZip();
265 265
             });
266 266
         }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         }
279 279
 
280 280
         return $response->setOutputFormat(null)
281
-          ->setBody(function () use ($node, $encode, $offset, $length) {
281
+          ->setBody(function() use ($node, $encode, $offset, $length) {
282 282
               $mime = $node->getContentType();
283 283
               $stream = $node->get();
284 284
               $name = $node->getName();
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function postReadonly($id = null, $p = null, bool $readonly = true): Response
351 351
     {
352
-        return $this->bulk($id, $p, function ($node) use ($readonly) {
352
+        return $this->bulk($id, $p, function($node) use ($readonly) {
353 353
             $node->setReadonly($readonly);
354 354
 
355 355
             return ['status' => 204];
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
      */
595 595
     public function postMetaAttributes(?string $id = null, ?string $p = null): Response
596 596
     {
597
-        return $this->bulk($id, $p, function ($node) {
597
+        return $this->bulk($id, $p, function($node) {
598 598
             $node->setMetaAttributes($_POST);
599 599
 
600 600
             return ['status' => 204];
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
             );
677 677
         }
678 678
 
679
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
679
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
680 680
             $result = $node->copyTo($parent, $conflict);
681 681
 
682 682
             return [
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
             );
738 738
         }
739 739
 
740
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
740
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
741 741
             $result = $node->setParent($parent, $conflict);
742 742
             if (NodeInterface::CONFLICT_RENAME === $conflict) {
743 743
                 return [
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
             $at = $this->_verifyAttributes(['destroy' => $at])['destroy'];
793 793
         }
794 794
 
795
-        return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) {
795
+        return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) {
796 796
             if (null === $at) {
797 797
                 $node->delete($force && $node->isDeleted() || $force && $ignore_flag);
798 798
             } else {
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -286,49 +286,49 @@  discard block
 block discarded – undo
286 286
         }
287 287
 
288 288
         return $response->setOutputFormat(null)
289
-          ->setBody(function () use ($node, $encode, $offset, $length) {
290
-              $mime = $node->getContentType();
291
-              $stream = $node->get();
292
-              $name = $node->getName();
293
-
294
-              if (null === $stream) {
295
-                  return;
296
-              }
297
-
298
-              if (0 !== $offset) {
299
-                  if (fseek($stream, $offset) === -1) {
300
-                      throw new Exception\Conflict(
301
-                          'invalid offset requested',
302
-                          Exception\Conflict::INVALID_OFFSET
303
-                      );
304
-                  }
305
-              }
306
-
307
-              $read = 0;
308
-              header('Content-Type: '.$mime.'');
309
-              if ('base64' === $encode) {
310
-                  header('Content-Encoding: base64');
311
-                  while (!feof($stream)) {
312
-                      if (0 !== $length && $read + 8192 > $length) {
313
-                          echo base64_encode(fread($stream, $length - $read));
314
-                          exit();
315
-                      }
316
-
317
-                      echo base64_encode(fread($stream, 8192));
318
-                      $read += 8192;
319
-                  }
320
-              } else {
321
-                  while (!feof($stream)) {
322
-                      if (0 !== $length && $read + 8192 > $length) {
323
-                          echo fread($stream, $length - $read);
324
-                          exit();
325
-                      }
326
-
327
-                      echo fread($stream, 8192);
328
-                      $read += 8192;
329
-                  }
330
-              }
331
-          });
289
+            ->setBody(function () use ($node, $encode, $offset, $length) {
290
+                $mime = $node->getContentType();
291
+                $stream = $node->get();
292
+                $name = $node->getName();
293
+
294
+                if (null === $stream) {
295
+                    return;
296
+                }
297
+
298
+                if (0 !== $offset) {
299
+                    if (fseek($stream, $offset) === -1) {
300
+                        throw new Exception\Conflict(
301
+                            'invalid offset requested',
302
+                            Exception\Conflict::INVALID_OFFSET
303
+                        );
304
+                    }
305
+                }
306
+
307
+                $read = 0;
308
+                header('Content-Type: '.$mime.'');
309
+                if ('base64' === $encode) {
310
+                    header('Content-Encoding: base64');
311
+                    while (!feof($stream)) {
312
+                        if (0 !== $length && $read + 8192 > $length) {
313
+                            echo base64_encode(fread($stream, $length - $read));
314
+                            exit();
315
+                        }
316
+
317
+                        echo base64_encode(fread($stream, 8192));
318
+                        $read += 8192;
319
+                    }
320
+                } else {
321
+                    while (!feof($stream)) {
322
+                        if (0 !== $length && $read + 8192 > $length) {
323
+                            echo fread($stream, $length - $read);
324
+                            exit();
325
+                        }
326
+
327
+                        echo fread($stream, 8192);
328
+                        $read += 8192;
329
+                    }
330
+                }
331
+            });
332 332
     }
333 333
 
334 334
     /**
@@ -1329,9 +1329,9 @@  discard block
 block discarded – undo
1329 1329
                 $node->zip($archive);
1330 1330
             } catch (\Exception $e) {
1331 1331
                 $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [
1332
-                   'category' => get_class($this),
1333
-                   'exception' => $e,
1334
-               ]);
1332
+                    'category' => get_class($this),
1333
+                    'exception' => $e,
1334
+                ]);
1335 1335
             }
1336 1336
         }
1337 1337
 
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Notifier.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
             if ($node instanceof Collection && $recursive === true) {
350 350
                 $db = $this->db;
351
-                $node->doRecursiveAction(function ($child) use ($db, $subscription) {
351
+                $node->doRecursiveAction(function($child) use ($db, $subscription) {
352 352
                     $subscription['node'] = $child->getId();
353 353
                     $db->subscription->replaceOne(
354 354
                         [
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
             if ($node instanceof Collection && $recursive === true) {
376 376
                 $db = $this->db;
377
-                $node->doRecursiveAction(function ($child) use ($db, $node_id, $user_id) {
377
+                $node->doRecursiveAction(function($child) use ($db, $node_id, $user_id) {
378 378
                     $db->subscription->deleteOne([
379 379
                         'user' => $user_id,
380 380
                         'node' => $node_id,
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -93,6 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     /**
95 95
      * Send notification.
96
+     * @param User $sender
96 97
      */
97 98
     public function notify(iterable $receiver, ?User $sender, MessageInterface $message): bool
98 99
     {
@@ -180,6 +181,7 @@  discard block
 block discarded – undo
180 181
 
181 182
     /**
182 183
      * Add notification.
184
+     * @param User $sender
183 185
      */
184 186
     public function postNotification(User $receiver, ?User $sender, MessageInterface $message): ObjectId
185 187
     {
@@ -206,6 +208,8 @@  discard block
 block discarded – undo
206 208
 
207 209
     /**
208 210
      * Get notifications.
211
+     * @param integer $offset
212
+     * @param integer $limit
209 213
      */
210 214
     public function getNotifications(User $user, array $query = [], ?int $offset = null, ?int $limit = null, ?int &$total = null): iterable
211 215
     {
@@ -288,6 +292,7 @@  discard block
 block discarded – undo
288 292
 
289 293
     /**
290 294
      * Get subscription.
295
+     * @return NodeInterface
291 296
      */
292 297
     public function getSubscription(NodeInterface $node, User $user): ?array
293 298
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/File.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @param string $id
119 119
      * @param string $p
120
-     * @param string $version
120
+     * @param integer $version
121 121
      */
122 122
     public function postRestore(int $version, ?string $id = null, ?string $p = null): Response
123 123
     {
@@ -406,6 +406,9 @@  discard block
 block discarded – undo
406 406
 
407 407
     /**
408 408
      * Get storage.
409
+     * @param string|null $id
410
+     * @param string|null $p
411
+     * @param string|null $collection
409 412
      */
410 413
     protected function getStorage($id, $p, $collection): StorageAdapterInterface
411 414
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/Helper.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,68 +34,68 @@
 block discarded – undo
34 34
         }
35 35
 
36 36
         return $response
37
-          ->setOutputFormat(null)
38
-          ->setBody(function () use ($file) {
39
-              $stream = $file->get();
40
-              $name = $file->getName();
41
-
42
-              if (null === $stream) {
43
-                  return;
44
-              }
45
-
46
-              $size = $file->getSize();
47
-              $length = $size;
48
-              $start = 0;
49
-              $end = $size - 1;
50
-
51
-              if (isset($_SERVER['HTTP_RANGE'])) {
52
-                  header('Accept-Ranges: bytes');
53
-                  $c_start = $start;
54
-                  $c_end = $end;
55
-                  list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
56
-
57
-                  if (strpos($range, ',') !== false) {
58
-                      header("Content-Range: bytes $start-$end/$size");
59
-
60
-                      throw new Exception\InvalidRange('invalid offset/limit requested');
61
-                  }
62
-
63
-                  if ($range == '-') {
64
-                      $c_start = $size - substr($range, 1);
65
-                  } else {
66
-                      $range = explode('-', $range);
67
-                      $c_start = $range[0];
68
-                      $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
69
-                  }
70
-
71
-                  $c_end = ($c_end > $end) ? $end : $c_end;
72
-                  if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
73
-                      header("Content-Range: bytes $start-$end/$size");
74
-
75
-                      throw new Exception\InvalidRange('invalid offset/limit requested');
76
-                  }
77
-
78
-                  $start = (int) $c_start;
79
-                  $end = (int) $c_end;
80
-                  $length = (int) $end - $start + 1;
81
-                  fseek($stream, $start);
82
-                  header('HTTP/1.1 206 Partial Content');
83
-                  header("Content-Range: bytes $start-$end/$size");
84
-              }
85
-
86
-              header('Content-Length: '.$length);
87
-              $buffer = 1024 * 8;
88
-
89
-              while (!feof($stream) && ($p = ftell($stream)) <= $end) {
90
-                  if ($p + $buffer > $end) {
91
-                      $buffer = $end - $p + 1;
92
-                  }
93
-
94
-                  echo fread($stream, $buffer);
95
-                  flush();
96
-              }
97
-
98
-              fclose($stream);
99
-          });
37
+            ->setOutputFormat(null)
38
+            ->setBody(function () use ($file) {
39
+                $stream = $file->get();
40
+                $name = $file->getName();
41
+
42
+                if (null === $stream) {
43
+                    return;
44
+                }
45
+
46
+                $size = $file->getSize();
47
+                $length = $size;
48
+                $start = 0;
49
+                $end = $size - 1;
50
+
51
+                if (isset($_SERVER['HTTP_RANGE'])) {
52
+                    header('Accept-Ranges: bytes');
53
+                    $c_start = $start;
54
+                    $c_end = $end;
55
+                    list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
56
+
57
+                    if (strpos($range, ',') !== false) {
58
+                        header("Content-Range: bytes $start-$end/$size");
59
+
60
+                        throw new Exception\InvalidRange('invalid offset/limit requested');
61
+                    }
62
+
63
+                    if ($range == '-') {
64
+                        $c_start = $size - substr($range, 1);
65
+                    } else {
66
+                        $range = explode('-', $range);
67
+                        $c_start = $range[0];
68
+                        $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
69
+                    }
70
+
71
+                    $c_end = ($c_end > $end) ? $end : $c_end;
72
+                    if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
73
+                        header("Content-Range: bytes $start-$end/$size");
74
+
75
+                        throw new Exception\InvalidRange('invalid offset/limit requested');
76
+                    }
77
+
78
+                    $start = (int) $c_start;
79
+                    $end = (int) $c_end;
80
+                    $length = (int) $end - $start + 1;
81
+                    fseek($stream, $start);
82
+                    header('HTTP/1.1 206 Partial Content');
83
+                    header("Content-Range: bytes $start-$end/$size");
84
+                }
85
+
86
+                header('Content-Length: '.$length);
87
+                $buffer = 1024 * 8;
88
+
89
+                while (!feof($stream) && ($p = ftell($stream)) <= $end) {
90
+                    if ($p + $buffer > $end) {
91
+                        $buffer = $end - $p + 1;
92
+                    }
93
+
94
+                    echo fread($stream, $buffer);
95
+                    flush();
96
+                }
97
+
98
+                fclose($stream);
99
+            });
100 100
     }
101 101
 }
Please login to merge, or discard this patch.
src/lib/Filesystem/Node/Collection.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -656,6 +656,7 @@
 block discarded – undo
656 656
 
657 657
     /**
658 658
      * Create new file as a child from this collection.
659
+     * @param string $name
659 660
      */
660 661
     public function addFile($name, ?ObjectId $session = null, array $attributes = [], int $conflict = NodeInterface::CONFLICT_NOACTION, bool $clone = false): File
661 662
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
 use Balloon\Filesystem\Exception;
18 18
 use Balloon\Filesystem\Storage\Adapter\AdapterInterface as StorageAdapterInterface;
19 19
 use Balloon\Hook;
20
-use Balloon\Server\User;
21 20
 use Generator;
22 21
 use MimeType\MimeType;
23 22
 use function MongoDB\BSON\fromJSON;
Please login to merge, or discard this patch.