Completed
Pull Request — master (#429)
by Raffael
03:46
created
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.Notification/AttributeDecorator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             'message' => (string) $message['body'],
99 99
             'subject' => (string) $message['subject'],
100 100
             'locale' => (string) $message['locale'],
101
-            'sender' => function ($message) use ($server, $role_decorator) {
101
+            'sender' => function($message) use ($server, $role_decorator) {
102 102
                 if (!isset($message['sender'])) {
103 103
                     return null;
104 104
                 }
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
                     return null;
110 110
                 }
111 111
             },
112
-            'created' => function ($message) {
112
+            'created' => function($message) {
113 113
                 return (new DateTime())->setTimestamp($message['_id']->getTimestamp())->format('c');
114 114
             },
115
-            'node' => function ($message) use ($node_decorator, $fs) {
115
+            'node' => function($message) use ($node_decorator, $fs) {
116 116
                 if (isset($message['node'])) {
117 117
                     try {
118 118
                         return $node_decorator->decorate($fs->findNodeById($message['node']), ['id', 'name', '_links']);
Please login to merge, or discard this patch.
src/lib/Async/WorkerFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     protected function setErrorHandler(LoggerInterface $logger): self
56 56
     {
57
-        set_error_handler(function ($severity, $message, $file, $line) use ($logger) {
57
+        set_error_handler(function($severity, $message, $file, $line) use ($logger) {
58 58
             $log = $message.' in '.$file.':'.$line;
59 59
 
60 60
             switch ($severity) {
Please login to merge, or discard this patch.
src/lib/Filesystem/Delta.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@
 block discarded – undo
246 246
                         $delta[$share_member->getPath()] = $share_member;
247 247
                     }
248 248
                 } elseif ('undeleteCollection' === $log['operation'] || 'undeleteCollectionShare' === $log['operation']) {
249
-                    $log_node->doRecursiveAction(function ($sub_node) use (&$delta) {
249
+                    $log_node->doRecursiveAction(function($sub_node) use (&$delta) {
250 250
                         $delta[$sub_node->getPath()] = $sub_node;
251 251
                     });
252 252
                 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     /**
100 100
      * Build a single dimension array with all nodes.
101
+     * @param integer[] $cursor
101 102
      */
102 103
     public function buildFeedFromCurrentState(?array $cursor = null, int $limit = 100, ?NodeInterface $node = null): array
103 104
     {
@@ -220,6 +221,7 @@  discard block
 block discarded – undo
220 221
 
221 222
     /**
222 223
      * Get delta feed with changes and cursor.
224
+     * @param NodeInterface $node
223 225
      */
224 226
     public function getDeltaFeed(?string $cursor = null, int $limit = 250, ?NodeInterface $node = null): array
225 227
     {
@@ -327,6 +329,7 @@  discard block
 block discarded – undo
327 329
 
328 330
     /**
329 331
      * Get event log.
332
+     * @param NodeInterface $node
330 333
      */
331 334
     public function getEventLog(array $query = [], int $limit = 100, int $skip = 0, ?NodeInterface $node = null, ?int &$total = null): iterable
332 335
     {
@@ -584,6 +587,7 @@  discard block
 block discarded – undo
584 587
 
585 588
     /**
586 589
      * Get children with custom filter.
590
+     * @param integer $limit
587 591
      */
588 592
     protected function findNodeAttributesWithCustomFilter(
589 593
         ?array $filter = null,
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Nodes.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -958,9 +958,9 @@
 block discarded – undo
958 958
                 $node->zip($archive);
959 959
             } catch (\Exception $e) {
960 960
                 $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [
961
-                   'category' => get_class($this),
962
-                   'exception' => $e,
963
-               ]);
961
+                    'category' => get_class($this),
962
+                    'exception' => $e,
963
+                ]);
964 964
             }
965 965
         }
966 966
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             }
100 100
         }
101 101
 
102
-        return $this->bulk($id, function ($node) use ($parent, $conflict, $move) {
102
+        return $this->bulk($id, function($node) use ($parent, $conflict, $move) {
103 103
             if (true === $move) {
104 104
                 $node = $node->setParent($parent, $conflict);
105 105
             }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             return (new Response())->setCode(200)->setBody($result);
167 167
         }
168 168
 
169
-        return $this->bulk($id, function ($node) use ($attributes) {
169
+        return $this->bulk($id, function($node) use ($attributes) {
170 170
             return [
171 171
                 'code' => 200,
172 172
                 'data' => $this->node_decorator->decorate($node, $attributes),
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
     public function patch(string $id, ?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null, $lock = null): Response
203 203
     {
204 204
         $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl', 'lock');
205
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
205
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
206 206
 
207 207
         $lock = $_SERVER['HTTP_LOCK_TOKEN'] ?? null;
208 208
 
209
-        return $this->bulk($id, function ($node) use ($attributes, $lock) {
209
+        return $this->bulk($id, function($node) use ($attributes, $lock) {
210 210
             foreach ($attributes as $attribute => $value) {
211 211
                 switch ($attribute) {
212 212
                     case 'name':
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND);
264 264
         }
265 265
 
266
-        return $this->bulk($id, function ($node) use ($parent, $conflict) {
266
+        return $this->bulk($id, function($node) use ($parent, $conflict) {
267 267
             $result = $node->copyTo($parent, $conflict);
268 268
 
269 269
             return [
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND);
288 288
         }
289 289
 
290
-        return $this->bulk($id, function ($node) use ($parent, $conflict) {
290
+        return $this->bulk($id, function($node) use ($parent, $conflict) {
291 291
             $result = $node->setParent($parent, $conflict);
292 292
 
293 293
             return [
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             $at = $this->_verifyAttributes(['destroy' => $at])['destroy'];
313 313
         }
314 314
 
315
-        return $this->bulk($id, function ($node) use ($force, $ignore_flag, $at) {
315
+        return $this->bulk($id, function($node) use ($force, $ignore_flag, $at) {
316 316
             if (null === $at) {
317 317
                 $node->delete($force && $node->isDeleted() || $force && $ignore_flag);
318 318
             } else {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/Helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
         return $response
37 37
           ->setOutputFormat(null)
38
-          ->setBody(function () use ($file) {
38
+          ->setBody(function() use ($file) {
39 39
               $stream = $file->get();
40 40
               $name = $file->getName();
41 41
 
Please login to merge, or discard this patch.
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -40,69 +40,69 @@
 block discarded – undo
40 40
         }
41 41
 
42 42
         return $response
43
-          ->setOutputFormat(null)
44
-          ->setBody(function () use ($file) {
45
-              $stream = $file->get();
46
-              $name = $file->getName();
47
-
48
-              if (null === $stream) {
49
-                  return;
50
-              }
51
-
52
-              $size = $file->getSize();
53
-              $length = $size;
54
-              $start = 0;
55
-              $end = $size - 1;
56
-
57
-              set_time_limit(0);
58
-              if (isset($_SERVER['HTTP_RANGE'])) {
59
-                  header('Accept-Ranges: bytes');
60
-                  $c_start = $start;
61
-                  $c_end = $end;
62
-                  list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
63
-
64
-                  if (strpos($range, ',') !== false) {
65
-                      header("Content-Range: bytes $start-$end/$size");
66
-
67
-                      throw new Exception\InvalidRange('invalid offset/limit requested');
68
-                  }
69
-
70
-                  if ($range == '-') {
71
-                      $c_start = $size - substr($range, 1);
72
-                  } else {
73
-                      $range = explode('-', $range);
74
-                      $c_start = $range[0];
75
-                      $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
76
-                  }
77
-
78
-                  $c_end = ($c_end > $end) ? $end : $c_end;
79
-                  if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
80
-                      header("Content-Range: bytes $start-$end/$size");
81
-
82
-                      throw new Exception\InvalidRange('invalid offset/limit requested');
83
-                  }
84
-
85
-                  $start = (int) $c_start;
86
-                  $end = (int) $c_end;
87
-                  $length = (int) $end - $start + 1;
88
-                  fseek($stream, $start);
89
-                  header('HTTP/1.1 206 Partial Content');
90
-                  header("Content-Range: bytes $start-$end/$size");
91
-              }
92
-
93
-              header('Content-Length: '.$length);
94
-              $buffer = 1024 * 8;
95
-
96
-              while (!feof($stream) && ($p = ftell($stream)) <= $end) {
97
-                  if ($p + $buffer > $end) {
98
-                      $buffer = $end - $p + 1;
99
-                  }
100
-
101
-                  echo fread($stream, $buffer);
102
-                  flush();
103
-              }
104
-
105
-              fclose($stream);
106
-          });
43
+            ->setOutputFormat(null)
44
+            ->setBody(function () use ($file) {
45
+                $stream = $file->get();
46
+                $name = $file->getName();
47
+
48
+                if (null === $stream) {
49
+                    return;
50
+                }
51
+
52
+                $size = $file->getSize();
53
+                $length = $size;
54
+                $start = 0;
55
+                $end = $size - 1;
56
+
57
+                set_time_limit(0);
58
+                if (isset($_SERVER['HTTP_RANGE'])) {
59
+                    header('Accept-Ranges: bytes');
60
+                    $c_start = $start;
61
+                    $c_end = $end;
62
+                    list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
63
+
64
+                    if (strpos($range, ',') !== false) {
65
+                        header("Content-Range: bytes $start-$end/$size");
66
+
67
+                        throw new Exception\InvalidRange('invalid offset/limit requested');
68
+                    }
69
+
70
+                    if ($range == '-') {
71
+                        $c_start = $size - substr($range, 1);
72
+                    } else {
73
+                        $range = explode('-', $range);
74
+                        $c_start = $range[0];
75
+                        $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
76
+                    }
77
+
78
+                    $c_end = ($c_end > $end) ? $end : $c_end;
79
+                    if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
80
+                        header("Content-Range: bytes $start-$end/$size");
81
+
82
+                        throw new Exception\InvalidRange('invalid offset/limit requested');
83
+                    }
84
+
85
+                    $start = (int) $c_start;
86
+                    $end = (int) $c_end;
87
+                    $length = (int) $end - $start + 1;
88
+                    fseek($stream, $start);
89
+                    header('HTTP/1.1 206 Partial Content');
90
+                    header("Content-Range: bytes $start-$end/$size");
91
+                }
92
+
93
+                header('Content-Length: '.$length);
94
+                $buffer = 1024 * 8;
95
+
96
+                while (!feof($stream) && ($p = ftell($stream)) <= $end) {
97
+                    if ($p + $buffer > $end) {
98
+                        $buffer = $end - $p + 1;
99
+                    }
100
+
101
+                    echo fread($stream, $buffer);
102
+                    flush();
103
+                }
104
+
105
+                fclose($stream);
106
+            });
107 107
     }
108 108
 }
Please login to merge, or discard this patch.
src/lib/Migration/Delta/SetPointerId.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $this->db->storage->updateOne(
50 50
                 ['_id' => $object['_id']],
51 51
                 [
52
-                   '$set' => ['pointer' => $pointer],
52
+                    '$set' => ['pointer' => $pointer],
53 53
                 ]
54 54
             );
55 55
         }
Please login to merge, or discard this patch.
src/lib/Filesystem/Node/Collection.php 3 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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $this->storage = $this->_parent->getStorage()->deleteCollection($this);
363 363
 
364 364
         if (!$this->isReference() && !$this->isMounted() && !$this->isFiltered()) {
365
-            $this->doRecursiveAction(function ($node) use ($recursion) {
365
+            $this->doRecursiveAction(function($node) use ($recursion) {
366 366
                 $node->delete(false, $recursion, false);
367 367
             }, NodeInterface::DELETED_EXCLUDE);
368 368
         }
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
     protected function _forceDelete(?string $recursion = null, bool $recursion_first = true): bool
918 918
     {
919 919
         if (!$this->isReference() && !$this->isMounted() && !$this->isFiltered()) {
920
-            $this->doRecursiveAction(function ($node) use ($recursion) {
920
+            $this->doRecursiveAction(function($node) use ($recursion) {
921 921
                 $node->delete(true, $recursion, false);
922 922
             }, NodeInterface::DELETED_INCLUDE);
923 923
         }
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/Controller.php 1 patch
Doc Comments   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,6 +249,8 @@  discard block
 block discarded – undo
249 249
      * Load nodes by id.
250 250
      *
251 251
      * @param null|mixed $class
252
+     * @param string $id
253
+     * @param string $path
252 254
      */
253 255
     public function getNodes(?array $id = null, ?array $path = null, $class = null, int $deleted = NodeInterface::DELETED_EXCLUDE): Generator
254 256
     {
@@ -277,9 +279,10 @@  discard block
 block discarded – undo
277 279
     /**
278 280
      * Load node.
279 281
      *
280
-     * @param null|mixed $id
281
-     * @param null|mixed $path
282
+     * @param string|null $id
283
+     * @param string|null $path
282 284
      * @param null|mixed $class
285
+     * @param integer $deleted
283 286
      */
284 287
     public function getNode($id = null, $path = null, $class = null, bool $multiple = false, bool $allow_root = false, ?int $deleted = null): NodeInterface
285 288
     {
@@ -359,7 +362,7 @@  discard block
 block discarded – undo
359 362
      * @param string $class      Force set node type
360 363
      * @param bool   $multiple   Allow $id to be an array
361 364
      * @param bool   $allow_root Allow instance of root collection
362
-     * @param bool   $deleted    How to handle deleted node
365
+     * @param integer   $deleted    How to handle deleted node
363 366
      */
364 367
     protected function _getNode(
365 368
         ?string $id = null,
@@ -391,7 +394,7 @@  discard block
 block discarded – undo
391 394
      * @param string $id
392 395
      * @param string $path
393 396
      * @param string $class   Force set node type
394
-     * @param bool   $deleted How to handle deleted node
397
+     * @param integer   $deleted How to handle deleted node
395 398
      */
396 399
     protected function _getNodes(
397 400
         $id = null,
Please login to merge, or discard this patch.