Completed
Branch dev (bc6e47)
by Raffael
02:23
created
src/app/Balloon.App.Elasticsearch/Elasticsearch.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@
 block discarded – undo
221 221
      * Search.
222 222
      *
223 223
      * @param array $query
224
-     * @param array $share
224
+     * @param array $shares
225 225
      *
226 226
      * @return array
227 227
      */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return Elasticsearch
87 87
      */
88
-    public function setOptions(?Iterable $config = null): self
88
+    public function setOptions(?Iterable $config = null) : self
89 89
     {
90 90
         if (null === $config) {
91 91
             return $this;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         foreach ($config as $option => $value) {
95 95
             switch ($option) {
96 96
                 case 'server':
97
-                    $this->es_server = (array) $value;
97
+                    $this->es_server = (array)$value;
98 98
 
99 99
                 break;
100 100
                 case 'index':
101
-                    $this->es_index = (string) $value;
101
+                    $this->es_index = (string)$value;
102 102
 
103 103
                 break;
104 104
                 default:
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             ],
149 149
         ]);
150 150
 
151
-        $user = (string) $this->user->getId();
151
+        $user = (string)$this->user->getId();
152 152
         foreach ($result['hits']['hits'] as $node) {
153 153
             $id = false;
154 154
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                     $_node = $this->fs->findNodeById($id);
160 160
                     if ($_node->isDeleted() && (1 === $deleted || 2 === $deleted)
161 161
                      || !$_node->isDeleted() && (0 === $deleted || 2 === $deleted)) {
162
-                        if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string) $_node->getId()])) {
163
-                            $list[(string) $_node->getId()] = $_node;
162
+                        if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string)$_node->getId()])) {
163
+                            $list[(string)$_node->getId()] = $_node;
164 164
                         }
165 165
                     }
166 166
                 } catch (\Exception $e) {
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
         $bool = $query['body']['query'];
231 231
 
232 232
         $filter1 = [];
233
-        $filter1['bool']['should'][]['term']['owner'] = (string) $this->user->getId();
234
-        $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string) $this->user->getId();
233
+        $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId();
234
+        $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string)$this->user->getId();
235 235
 
236 236
         $share_filter = [
237 237
             'bool' => [
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Hook/NewShareAdded.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
      * @param NodeInterface $node
163 163
      * @param User          $user
164 164
      *
165
-     * @return string
165
+     * @return boolean
166 166
      */
167 167
     protected function checkNotify(NodeInterface $node, User $user): bool
168 168
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return AbstractHook
83 83
      */
84
-    public function setOptions(?Iterable $config = null): AbstractHook
84
+    public function setOptions(?Iterable $config = null) : AbstractHook
85 85
     {
86 86
         if (null === $config) {
87 87
             return $this;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             switch ($option) {
92 92
                 case 'body':
93 93
                 case 'subject':
94
-                    $this->{$option} = (string) $value;
94
+                    $this->{$option} = (string)$value;
95 95
 
96 96
                 break;
97 97
                 default:
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @param string        $recursion
114 114
      * @param bool          $recursion_first
115 115
      */
116
-    public function postSaveNodeAttributes(NodeInterface $node, array $attributes, array $remove, ?string $recursion, bool $recursion_first): void
116
+    public function postSaveNodeAttributes(NodeInterface $node, array $attributes, array $remove, ?string $recursion, bool $recursion_first) : void
117 117
     {
118 118
         if (!($node instanceof Collection)) {
119 119
             return;
@@ -130,24 +130,24 @@  discard block
 block discarded – undo
130 130
         foreach ($node->getAcl() as $rule) {
131 131
             if ('user' === $rule['type']) {
132 132
                 $user = $this->server->getUserById(new ObjectId($rule['id']));
133
-                if (!isset($receiver[(string) $user->getId()]) && $this->checkNotify($node, $user)) {
134
-                    $receiver[(string) $user->getId()] = $user;
133
+                if (!isset($receiver[(string)$user->getId()]) && $this->checkNotify($node, $user)) {
134
+                    $receiver[(string)$user->getId()] = $user;
135 135
                 }
136 136
             } elseif ('group' === $rule['type']) {
137 137
                 foreach ($this->server->getGroupById($rule['id'])->getResolvedMember() as $user) {
138
-                    if (!isset($receiver[(string) $user->getId()]) && $this->checkNotify($node, $user)) {
139
-                        $receiver[(string) $user->getId()] = $user;
138
+                    if (!isset($receiver[(string)$user->getId()]) && $this->checkNotify($node, $user)) {
139
+                        $receiver[(string)$user->getId()] = $user;
140 140
                     }
141 141
                 }
142 142
             }
143 143
         }
144 144
 
145 145
         if (!empty($receiver)) {
146
-            $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) {
146
+            $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) {
147 147
                 return '';
148 148
                 //return $node->getAttributes()[$match[2]];
149 149
             }, $this->body);
150
-            $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) {
150
+            $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) {
151 151
                 return '';
152 152
                 //return $node->getAttributes()[$match[2]];
153 153
             }, $this->subject);
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Notifier.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
      * Add notification.
252 252
      *
253 253
      * @param array  $receiver
254
-     * @param User   $user
255 254
      * @param string $subject
256 255
      * @param string $body
257 256
      * @param array  $context
257
+     * @param User $sender
258 258
      *
259 259
      * @return ObjectId
260 260
      */
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     /**
296 296
      * Get notifications.
297 297
      *
298
-     * @param ObjectId $id
298
+     * @param User $id
299 299
      *
300 300
      * @return bool
301 301
      */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return Notifier
104 104
      */
105
-    public function setOptions(?Iterable $config = null): self
105
+    public function setOptions(?Iterable $config = null) : self
106 106
     {
107 107
         if (null === $config) {
108 108
             return $this;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      *
146 146
      * @return bool
147 147
      */
148
-    public function notify(array $receiver, ?User $sender, string $subject, string $body, array $context = []): bool
148
+    public function notify(array $receiver, ?User $sender, string $subject, string $body, array $context = []) : bool
149 149
     {
150 150
         if (0 === count($this->adapter)) {
151 151
             $this->logger->warning('there are no notification adapter enabled, notification can not be sent', [
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      *
186 186
      * @return AdapterInterface
187 187
      */
188
-    public function injectAdapter($adapter, ?string $name = null): AdapterAwareInterface
188
+    public function injectAdapter($adapter, ?string $name = null) : AdapterAwareInterface
189 189
     {
190 190
         if (!($adapter instanceof AdapterInterface)) {
191 191
             throw new Exception('adapter needs to implement AdapterInterface');
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @return ObjectId
260 260
      */
261
-    public function postNotification(array $receiver, ?User $sender, string $subject, string $body, array $context = []): ObjectId
261
+    public function postNotification(array $receiver, ?User $sender, string $subject, string $body, array $context = []) : ObjectId
262 262
     {
263 263
         $data = [
264 264
             'subject' => $subject,
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
                 'category' => get_class($this),
350 350
             ]);
351 351
 
352
-            if (isset($subs[(string) $this->user->getId()])) {
353
-                unset($subs[(string) $this->user->getId()]);
352
+            if (isset($subs[(string)$this->user->getId()])) {
353
+                unset($subs[(string)$this->user->getId()]);
354 354
             }
355 355
 
356 356
             $node->setAppAttribute(__NAMESPACE__, 'subscription', $subs);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 'category' => get_class($this),
360 360
             ]);
361 361
 
362
-            $subs[(string) $this->user->getId()] = new UTCDateTime();
362
+            $subs[(string)$this->user->getId()] = new UTCDateTime();
363 363
             $node->setAppAttribute(__NAMESPACE__, 'subscription', $subs);
364 364
         }
365 365
 
Please login to merge, or discard this patch.
src/app/Balloon.App.Preview/Hook.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace Balloon\App\Preview;
14 14
 
15
-use Balloon\Exception;
16 15
 use Balloon\Filesystem\Node\File;
17 16
 use Balloon\Hook\AbstractHook;
18 17
 use MongoDB\GridFS\Exception\FileNotFoundException;
Please login to merge, or discard this patch.
src/lib/Api/v1/Node.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @param array|string $id
283 283
      * @param array|string $p
284 284
      * @param int          $offset
285
-     * @param int          $legnth
285
+     * @param int          $length
286 286
      * @param string       $encode
287 287
      * @param bool         $download
288 288
      * @param string       $name
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
      * @param string $class      Force set node type
1421 1421
      * @param bool   $multiple   Allow $id to be an array
1422 1422
      * @param bool   $allow_root Allow instance of root collection
1423
-     * @param bool   $deleted    How to handle deleted node
1423
+     * @param integer   $deleted    How to handle deleted node
1424 1424
      *
1425 1425
      * @return NodeInterface
1426 1426
      */
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
      * @param string $id
1455 1455
      * @param string $path
1456 1456
      * @param string $class   Force set node type
1457
-     * @param bool   $deleted How to handle deleted node
1457
+     * @param integer   $deleted How to handle deleted node
1458 1458
      *
1459 1459
      * @return Generator
1460 1460
      */
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -320,50 +320,50 @@  discard block
 block discarded – undo
320 320
         }
321 321
 
322 322
         return (new Response())
323
-          ->setOutputFormat(null)
324
-          ->setBody(function () use ($node, $encode, $offset, $length) {
325
-              $mime = $node->getContentType();
326
-              $stream = $node->get();
327
-              $name = $node->getName();
328
-
329
-              if (null === $stream) {
330
-                  return;
331
-              }
332
-
333
-              if (0 !== $offset) {
334
-                  if (fseek($stream, $offset) === -1) {
335
-                      throw new Exception\Conflict(
323
+            ->setOutputFormat(null)
324
+            ->setBody(function () use ($node, $encode, $offset, $length) {
325
+                $mime = $node->getContentType();
326
+                $stream = $node->get();
327
+                $name = $node->getName();
328
+
329
+                if (null === $stream) {
330
+                    return;
331
+                }
332
+
333
+                if (0 !== $offset) {
334
+                    if (fseek($stream, $offset) === -1) {
335
+                        throw new Exception\Conflict(
336 336
                         'invalid offset requested',
337 337
                         Exception\Conflict::INVALID_OFFSET
338 338
                     );
339
-                  }
340
-              }
341
-
342
-              $read = 0;
343
-              header('Content-Type: '.$mime.'');
344
-              if ('base64' === $encode) {
345
-                  header('Content-Encoding: base64');
346
-                  while (!feof($stream)) {
347
-                      if (0 !== $length && $read + 8192 > $length) {
348
-                          echo base64_encode(fread($stream, $length - $read));
349
-                          exit();
350
-                      }
351
-
352
-                      echo base64_encode(fread($stream, 8192));
353
-                      $read += 8192;
354
-                  }
355
-              } else {
356
-                  while (!feof($stream)) {
357
-                      if (0 !== $length && $read + 8192 > $length) {
358
-                          echo fread($stream, $length - $read);
359
-                          exit();
360
-                      }
361
-
362
-                      echo fread($stream, 8192);
363
-                      $read += 8192;
364
-                  }
365
-              }
366
-          });
339
+                    }
340
+                }
341
+
342
+                $read = 0;
343
+                header('Content-Type: '.$mime.'');
344
+                if ('base64' === $encode) {
345
+                    header('Content-Encoding: base64');
346
+                    while (!feof($stream)) {
347
+                        if (0 !== $length && $read + 8192 > $length) {
348
+                            echo base64_encode(fread($stream, $length - $read));
349
+                            exit();
350
+                        }
351
+
352
+                        echo base64_encode(fread($stream, 8192));
353
+                        $read += 8192;
354
+                    }
355
+                } else {
356
+                    while (!feof($stream)) {
357
+                        if (0 !== $length && $read + 8192 > $length) {
358
+                            echo fread($stream, $length - $read);
359
+                            exit();
360
+                        }
361
+
362
+                        echo fread($stream, 8192);
363
+                        $read += 8192;
364
+                    }
365
+                }
366
+            });
367 367
     }
368 368
 
369 369
     /**
@@ -1502,9 +1502,9 @@  discard block
 block discarded – undo
1502 1502
                 $node->zip($archive);
1503 1503
             } catch (\Exception $e) {
1504 1504
                 $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [
1505
-                   'category' => get_class($this),
1506
-                   'exception' => $e,
1507
-               ]);
1505
+                    'category' => get_class($this),
1506
+                    'exception' => $e,
1507
+                ]);
1508 1508
             }
1509 1509
         }
1510 1510
 
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return Response
118 118
      */
119
-    public function head(?string $id = null, ?string $p = null, int $deleted = 0): Response
119
+    public function head(?string $id = null, ?string $p = null, int $deleted = 0) : Response
120 120
     {
121 121
         try {
122 122
             $result = $this->_getNode($id, $p, null, false, false, $deleted);
123 123
 
124 124
             $response = (new Response())
125
-                ->setHeader('Content-Length', (string) $result->getSize())
125
+                ->setHeader('Content-Length', (string)$result->getSize())
126 126
                 ->setHeader('Content-Type', $result->getContentType())
127 127
                 ->setCode(200);
128 128
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         ?string $destid = null,
179 179
         ?string $destp = null,
180 180
         int $conflict = 0
181
-    ): Response {
181
+    ) : Response {
182 182
         $parent = null;
183 183
 
184 184
         if (true === $move) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                     }
206 206
                 } catch (\Exception $e) {
207 207
                     $failures[] = [
208
-                        'id' => (string) $node->getId(),
208
+                        'id' => (string)$node->getId(),
209 209
                         'name' => $node->getName(),
210 210
                         'error' => get_class($e),
211 211
                         'message' => $e->getMessage(),
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
         ?string $encode = null,
296 296
         bool $download = false,
297 297
         string $name = 'selected'
298
-    ): ?Response {
298
+    ) : ?Response {
299 299
         if (is_array($id) || is_array($p)) {
300 300
             return $this->combine($id, $p, $name);
301 301
         }
302 302
 
303 303
         $node = $this->_getNode($id, $p);
304 304
         if ($node instanceof Collection) {
305
-            return (new Response())->setBody(function () use ($node) {
305
+            return (new Response())->setBody(function() use ($node) {
306 306
                 $node->getZip();
307 307
             });
308 308
         }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             $response->setHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($name));
314 314
             $response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
315 315
             $response->setHeader('Content-Type', 'application/octet-stream');
316
-            $response->setHeader('Content-Length', (string) $node->getSize());
316
+            $response->setHeader('Content-Length', (string)$node->getSize());
317 317
             $response->setHeader('Content-Transfer-Encoding', 'binary');
318 318
         } else {
319 319
             $response->setHeader('Content-Disposition', 'inline; filename*=UTF-8\'\''.rawurlencode($name));
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
         return (new Response())
323 323
           ->setOutputFormat(null)
324
-          ->setBody(function () use ($node, $encode, $offset, $length) {
324
+          ->setBody(function() use ($node, $encode, $offset, $length) {
325 325
               $mime = $node->getContentType();
326 326
               $stream = $node->get();
327 327
               $name = $node->getName();
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     $node->setReadonly($readonly);
402 402
                 } catch (\Exception $e) {
403 403
                     $failures[] = [
404
-                        'id' => (string) $node->getId(),
404
+                        'id' => (string)$node->getId(),
405 405
                         'name' => $node->getName(),
406 406
                         'error' => get_class($e),
407 407
                         'message' => $e->getMessage(),
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      *
590 590
      * @return Response
591 591
      */
592
-    public function getParent(?string $id = null, ?string $p = null, array $attributes = []): Response
592
+    public function getParent(?string $id = null, ?string $p = null, array $attributes = []) : Response
593 593
     {
594 594
         $result = Helper::escape(
595 595
             $this->decorator->decorate($this->_getNode($id, $p)->getParent(), $attributes)
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
      *
670 670
      * @return Response
671 671
      */
672
-    public function getParents(?string $id = null, ?string $p = null, array $attributes = [], bool $self = false): Response
672
+    public function getParents(?string $id = null, ?string $p = null, array $attributes = [], bool $self = false) : Response
673 673
     {
674 674
         $request = $this->_getNode($id, $p);
675 675
         $parents = $request->getParents();
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
      *
720 720
      * @return Response
721 721
      */
722
-    public function postMetaAttributes(?string $id = null, ?string $p = null): Response
722
+    public function postMetaAttributes(?string $id = null, ?string $p = null) : Response
723 723
     {
724 724
         if (is_array($id) || is_array($p)) {
725 725
             $failures = [];
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                     $node->setMetaAttribute(Helper::filter($_POST));
729 729
                 } catch (\Exception $e) {
730 730
                     $failures[] = [
731
-                        'id' => (string) $node->getId(),
731
+                        'id' => (string)$node->getId(),
732 732
                         'name' => $node->getName(),
733 733
                         'error' => get_class($e),
734 734
                         'message' => $e->getMessage(),
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
      *
782 782
      * @return Response
783 783
      */
784
-    public function postName(string $name, ?string $id = null, ?string $p = null): Response
784
+    public function postName(string $name, ?string $id = null, ?string $p = null) : Response
785 785
     {
786 786
         $this->_getNode($id, $p)->setName($name);
787 787
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         ?string $destid = null,
826 826
         ?string $destp = null,
827 827
         int $conflict = 0
828
-    ): Response {
828
+    ) : Response {
829 829
         try {
830 830
             $parent = $this->_getNode($destid, $destp, Collection::class, false, true);
831 831
         } catch (Exception\NotFound $e) {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                     $node->copyTo($parent, $conflict);
843 843
                 } catch (\Exception $e) {
844 844
                     $failures[] = [
845
-                        'id' => (string) $node->getId(),
845
+                        'id' => (string)$node->getId(),
846 846
                         'name' => $node->getName(),
847 847
                         'error' => get_class($e),
848 848
                         'message' => $e->getMessage(),
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
         }
865 865
         $result = $this->_getNode($id, $p)->copyTo($parent, $conflict);
866 866
 
867
-        return (new Response())->setCode(201)->setBody((string) $result->getId());
867
+        return (new Response())->setCode(201)->setBody((string)$result->getId());
868 868
     }
869 869
 
870 870
     /**
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
         ?string $destid = null,
912 912
         ?string $destp = null,
913 913
         int $conflict = 0
914
-    ): Response {
914
+    ) : Response {
915 915
         try {
916 916
             $parent = $this->_getNode($destid, $destp, Collection::class, false, true);
917 917
         } catch (Exception\NotFound $e) {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                     $node->setParent($parent, $conflict);
929 929
                 } catch (\Exception $e) {
930 930
                     $failures[] = [
931
-                        'id' => (string) $node->getId(),
931
+                        'id' => (string)$node->getId(),
932 932
                         'name' => $node->getName(),
933 933
                         'error' => get_class($e),
934 934
                         'message' => $e->getMessage(),
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
         bool $force = false,
996 996
         bool $ignore_flag = false,
997 997
         ?string $at = null
998
-    ): Response {
998
+    ) : Response {
999 999
         $failures = [];
1000 1000
 
1001 1001
         if (null !== $at && '0' !== $at) {
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                     }
1016 1016
                 } catch (\Exception $e) {
1017 1017
                     $failures[] = [
1018
-                        'id' => (string) $node->getId(),
1018
+                        'id' => (string)$node->getId(),
1019 1019
                         'name' => $node->getName(),
1020 1020
                         'error' => get_class($e),
1021 1021
                         'message' => $e->getMessage(),
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
         ?string $cursor = null,
1244 1244
         int $limit = 250,
1245 1245
         array $attributes = []
1246
-    ): Response {
1246
+    ) : Response {
1247 1247
         if (null !== $id || null !== $p) {
1248 1248
             $node = $this->_getNode($id, $p);
1249 1249
         } else {
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
      *
1359 1359
      * @return Response
1360 1360
      */
1361
-    public function getEventLog(?string $id = null, ?string $p = null, int $skip = 0, int $limit = 100): Response
1361
+    public function getEventLog(?string $id = null, ?string $p = null, int $skip = 0, int $limit = 100) : Response
1362 1362
     {
1363 1363
         if (null !== $id || null !== $p) {
1364 1364
             $node = $this->_getNode($id, $p);
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
      *
1400 1400
      * @return Response
1401 1401
      */
1402
-    public function getLastCursor(?string $id = null, ?string $p = null): Response
1402
+    public function getLastCursor(?string $id = null, ?string $p = null) : Response
1403 1403
     {
1404 1404
         if (null !== $id || null !== $p) {
1405 1405
             $node = $this->_getNode($id, $p);
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
         bool $multiple = false,
1432 1432
         bool $allow_root = false,
1433 1433
         int $deleted = 2
1434
-    ): NodeInterface {
1434
+    ) : NodeInterface {
1435 1435
         if (null === $class) {
1436 1436
             switch (get_class($this)) {
1437 1437
                 case ApiFile::class:
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
         $path = null,
1464 1464
         ?string $class = null,
1465 1465
         int $deleted = 2
1466
-    ): Generator {
1466
+    ) : Generator {
1467 1467
         if (null === $class) {
1468 1468
             switch (get_class($this)) {
1469 1469
                 case ApiFile::class:
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 
1549 1549
                 break;
1550 1550
                 case 'filter':
1551
-                    $attributes['filter'] = json_encode((array) $attributes['filter']);
1551
+                    $attributes['filter'] = json_encode((array)$attributes['filter']);
1552 1552
 
1553 1553
                 break;
1554 1554
                 case 'destroy':
@@ -1563,14 +1563,14 @@  discard block
 block discarded – undo
1563 1563
                     if (!Helper::isValidTimestamp($value)) {
1564 1564
                         throw new Exception\InvalidArgument($attribute.' Changed timestamp must be valid unix timestamp');
1565 1565
                     }
1566
-                    if ((int) $value > time()) {
1566
+                    if ((int)$value > time()) {
1567 1567
                         throw new Exception\InvalidArgument($attribute.' timestamp can not be set greater than the server time');
1568 1568
                     }
1569 1569
                     $attributes[$attribute] = new UTCDateTime($value.'000');
1570 1570
 
1571 1571
                 break;
1572 1572
                 case 'readonly':
1573
-                    $attributes['readonly'] = (bool) $attributes['readonly'];
1573
+                    $attributes['readonly'] = (bool)$attributes['readonly'];
1574 1574
 
1575 1575
                 break;
1576 1576
             }
Please login to merge, or discard this patch.
src/lib/Filesystem.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      *
292 292
      * @param array  $id
293 293
      * @param string $class   Force check node type
294
-     * @param bool   $deleted
294
+     * @param integer   $deleted
295 295
      *
296 296
      * @return Generator
297 297
      */
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      * @param string $class      Force set node type
412 412
      * @param bool   $multiple   Allow $id to be an array
413 413
      * @param bool   $allow_root Allow instance of root collection
414
-     * @param bool   $deleted    How to handle deleted node
414
+     * @param integer   $deleted    How to handle deleted node
415 415
      *
416 416
      * @return NodeInterface
417 417
      */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @return NodeInterface
206 206
      */
207
-    public function findNodeById($id, ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): NodeInterface
207
+    public function findNodeById($id, ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE) : NodeInterface
208 208
     {
209 209
         if (!is_string($id) && !($id instanceof ObjectId)) {
210 210
             throw new Exception\InvalidArgument($id.' node id has to be a string or instance of \MongoDB\BSON\ObjectId');
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      *
262 262
      * @return NodeInterface
263 263
      */
264
-    public function findNodeByPath(string $path = '', ?string $class = null): NodeInterface
264
+    public function findNodeByPath(string $path = '', ?string $class = null) : NodeInterface
265 265
     {
266 266
         if (empty($path) || '/' !== $path[0]) {
267 267
             $path = '/'.$path;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
      *
296 296
      * @return Generator
297 297
      */
298
-    public function findNodesById(array $id = [], ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): Generator
298
+    public function findNodesById(array $id = [], ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE) : Generator
299 299
     {
300 300
         $find = [];
301 301
         foreach ($id as $i) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      *
342 342
      * @return Generator
343 343
      */
344
-    public function findNodesByPath(array $path = [], ?string $class = null): Generator
344
+    public function findNodesByPath(array $path = [], ?string $class = null) : Generator
345 345
     {
346 346
         $find = [];
347 347
         foreach ($path as $p) {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      *
380 380
      * @return Generator
381 381
      */
382
-    public function getNodes(?array $id = null, ?array $path = null, $class = null, int $deleted = NodeInterface::DELETED_EXCLUDE): Generator
382
+    public function getNodes(? array $id = null, ? array $path = null, $class = null, int $deleted = NodeInterface::DELETED_EXCLUDE) : Generator
383 383
     {
384 384
         if (null === $id && null === $path) {
385 385
             throw new Exception\InvalidArgument('neither parameter id nor p (path) was given');
Please login to merge, or discard this patch.
src/lib/Filesystem/Node/File.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
      * @param string $path
695 695
      * @param bool   $new
696 696
      *
697
-     * @return bool
697
+     * @return string
698 698
      */
699 699
     protected function verifyFile(?string $path, bool $new = false): string
700 700
     {
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     /**
828 828
      * Finalize put request.
829 829
      *
830
-     * @param resource|string $file
830
+     * @param string|null $file
831 831
      * @param bool            $new
832 832
      * @param array           $attributes
833 833
      *
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 use Balloon\Helper;
21 21
 use Balloon\Hook;
22 22
 use Balloon\Mime;
23
-use Balloon\Server\User;
24 23
 use MongoDB\BSON\UTCDateTime;
25 24
 use Psr\Log\LoggerInterface;
26 25
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -589,7 +589,7 @@
 block discarded – undo
589 589
         ]);
590 590
 
591 591
         $this->addVersion($attributes)
592
-             ->postPutFile($file, $new, $attributes);
592
+                ->postPutFile($file, $new, $attributes);
593 593
 
594 594
         return $this->version;
595 595
     }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
      * @param array
47 47
      **/
48 48
     protected $temp_files = [
49
-        '/^\._(.*)$/',     // OS/X resource forks
50
-        '/^.DS_Store$/',   // OS/X custom folder settings
49
+        '/^\._(.*)$/', // OS/X resource forks
50
+        '/^.DS_Store$/', // OS/X custom folder settings
51 51
         '/^desktop.ini$/', // Windows custom folder settings
52
-        '/^Thumbs.db$/',   // Windows thumbnail cache
53
-        '/^.(.*).swpx$/',  // ViM temporary files
54
-        '/^.(.*).swx$/',   // ViM temporary files
55
-        '/^.(.*).swp$/',   // ViM temporary files
56
-        '/^\.dat(.*)$/',   // Smultron seems to create these
52
+        '/^Thumbs.db$/', // Windows thumbnail cache
53
+        '/^.(.*).swpx$/', // ViM temporary files
54
+        '/^.(.*).swx$/', // ViM temporary files
55
+        '/^.(.*).swp$/', // ViM temporary files
56
+        '/^\.dat(.*)$/', // Smultron seems to create these
57 57
         '/^~lock.(.*)#$/', // Windows 7 lockfiles
58 58
     ];
59 59
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      *
155 155
      * @return NodeInterface
156 156
      */
157
-    public function copyTo(Collection $parent, int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true): NodeInterface
157
+    public function copyTo(Collection $parent, int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : NodeInterface
158 158
     {
159 159
         $this->_hook->run(
160 160
             'preCopyFile',
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $filtered = [];
199 199
 
200 200
         foreach ($history as $version) {
201
-            $v = (array) $version;
201
+            $v = (array)$version;
202 202
 
203 203
             $v['user'] = $this->_fs->getServer()->getUserById($version['user'])->getUsername();
204 204
             $v['changed'] = Helper::DateTimeToUnix($version['changed']);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @return bool
322 322
      */
323
-    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true): bool
323
+    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool
324 324
     {
325 325
         if (!$this->_acl->isAllowed($this, 'w')) {
326 326
             throw new ForbiddenException(
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         }
552 552
 
553 553
         $this->hash = $new_hash;
554
-        $max = (int) (string) $this->_fs->getServer()->getMaxFileVersion();
554
+        $max = (int)(string)$this->_fs->getServer()->getMaxFileVersion();
555 555
         if (count($this->history) >= $max) {
556 556
             $del = key($this->history);
557 557
             $this->_logger->debug('history limit ['.$max.'] reached, remove oldest version ['.$del.'] from file ['.$this->_id.']', [
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
     {
646 646
         assert(16 === strlen($data));
647 647
 
648
-        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
649
-        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
648
+        $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100
649
+        $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10
650 650
 
651 651
         return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
652 652
     }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
      *
697 697
      * @return bool
698 698
      */
699
-    protected function verifyFile(?string $path, bool $new = false): string
699
+    protected function verifyFile(?string $path, bool $new = false) : string
700 700
     {
701 701
         if (null === $path) {
702 702
             $this->size = 0;
@@ -749,11 +749,11 @@  discard block
 block discarded – undo
749 749
 
750 750
             $tmp_file = $tmp.DIRECTORY_SEPARATOR.$this->guidv4(openssl_random_pseudo_bytes(16));
751 751
             $stream = fopen($tmp_file, 'w+');
752
-            $size = stream_copy_to_stream($file, $stream, ((int) $this->_fs->getServer()->getMaxFileSize() + 1));
752
+            $size = stream_copy_to_stream($file, $stream, ((int)$this->_fs->getServer()->getMaxFileSize() + 1));
753 753
             rewind($stream);
754 754
             fclose($file);
755 755
 
756
-            if ($size > (int) $this->_fs->getServer()->getMaxFileSize()) {
756
+            if ($size > (int)$this->_fs->getServer()->getMaxFileSize()) {
757 757
                 unlink($tmp_file);
758 758
 
759 759
                 throw new Exception\InsufficientStorage(
Please login to merge, or discard this patch.
src/lib/Filesystem/Node/NodeInterface.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,14 +108,13 @@
 block discarded – undo
108 108
      *
109 109
      * @param bool $reference
110 110
      *
111
-     * @return ObjectId
111
+     * @return ObjectId|null
112 112
      */
113 113
     public function getShareId(bool $reference = false): ?ObjectId;
114 114
 
115 115
     /**
116 116
      * Get share node.
117 117
      *
118
-     * @param bool $reference
119 118
      *
120 119
      * @return Collection
121 120
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return bool
58 58
      */
59
-    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true): bool;
59
+    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool;
60 60
 
61 61
     /**
62 62
      * Set filesystem.
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return NodeInterface
103 103
      */
104
-    public function copyTo(Collection $parent, int $conflict = self::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true): self;
104
+    public function copyTo(Collection $parent, int $conflict = self::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : self;
105 105
 
106 106
     /**
107 107
      * Get share id.
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @return bool
206 206
      */
207
-    public function undelete(int $conflict = self::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true): bool;
207
+    public function undelete(int $conflict = self::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : bool;
208 208
 
209 209
     /**
210 210
      * Is node deleted?
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      *
235 235
      * @return array
236 236
      */
237
-    public function getParents(?self $node = null, array $parents = []): array;
237
+    public function getParents(?self $node = null, array $parents = []) : array;
238 238
 
239 239
     /**
240 240
      * Download.
Please login to merge, or discard this patch.
src/lib/Server/User.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -618,7 +618,7 @@
 block discarded – undo
618 618
     /**
619 619
      * Save.
620 620
      *
621
-     * @param array $attributes
621
+     * @param string[] $attributes
622 622
      *
623 623
      * @throws Exception\InvalidArgument if a given argument is not valid
624 624
      *
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
      * @var array
145 145
      */
146 146
     protected static $valid_attributes = [
147
-         'id',
148
-         'username',
149
-         'created',
150
-         'soft_quota',
151
-         'hard_quota',
152
-         'mail',
153
-         'namespace',
154
-         'last_attr_sync',
155
-         'avatar',
156
-         'created',
157
-         'admin',
158
-     ];
147
+            'id',
148
+            'username',
149
+            'created',
150
+            'soft_quota',
151
+            'hard_quota',
152
+            'mail',
153
+            'namespace',
154
+            'last_attr_sync',
155
+            'avatar',
156
+            'created',
157
+            'admin',
158
+        ];
159 159
 
160 160
     /**
161 161
      * Instance user.
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 
800 800
         $ops[] = [
801 801
             '$sort' => [
802
-               'sum' => -1,
803
-               '_id' => 1,
802
+                'sum' => -1,
803
+                '_id' => 1,
804 804
             ],
805 805
         ];
806 806
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
             switch ($attr) {
243 243
                 case 'id':
244
-                    $this->_id = (string) $value;
244
+                    $this->_id = (string)$value;
245 245
 
246 246
                 break;
247 247
                 case 'avatar':
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         if (empty($attribute)) {
288 288
             $requested = $default;
289 289
         } elseif (is_string($attribute)) {
290
-            $requested = (array) $attribute;
290
+            $requested = (array)$attribute;
291 291
         } elseif (is_array($attribute)) {
292 292
             $requested = $attribute;
293 293
         }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
             switch ($attr) {
302 302
                 case 'id':
303
-                    $resolved['id'] = (string) $this->_id;
303
+                    $resolved['id'] = (string)$this->_id;
304 304
 
305 305
                 break;
306 306
                 case 'avatar':
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             }
357 357
 
358 358
             if (true === $string) {
359
-                $found[] = (string) $share;
359
+                $found[] = (string)$share;
360 360
             } else {
361 361
                 $found[] = $share;
362 362
             }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             '$or' => [
459 459
                 ['acl' => [
460 460
                     '$elemMatch' => [
461
-                        'id' => (string) $this->_id,
461
+                        'id' => (string)$this->_id,
462 462
                         'type' => 'user',
463 463
                     ],
464 464
                 ]],
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         $list = [];
475 475
         foreach ($item as $child) {
476 476
             $found[] = $child['_id'];
477
-            $list[(string) $child['_id']] = $child;
477
+            $list[(string)$child['_id']] = $child;
478 478
         }
479 479
 
480 480
         if (empty($found)) {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
         $new = array_diff($found, $exists);
513 513
         foreach ($new as $add) {
514
-            $node = $list[(string) $add];
514
+            $node = $list[(string)$add];
515 515
 
516 516
             $this->logger->info('found new share ['.$node['_id'].']', [
517 517
                 'category' => get_class($this),
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
      */
595 595
     public function setHardQuota(int $quota): self
596 596
     {
597
-        $this->hard_quota = (int) $quota;
597
+        $this->hard_quota = (int)$quota;
598 598
         $this->save(['hard_quota']);
599 599
 
600 600
         return $this;
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      */
610 610
     public function setSoftQuota(int $quota): self
611 611
     {
612
-        $this->soft_quota = (int) $quota;
612
+        $this->soft_quota = (int)$quota;
613 613
         $this->save(['soft_quota']);
614 614
 
615 615
         return $this;
Please login to merge, or discard this patch.