Completed
Branch dev (bc6e47)
by Raffael
02:23
created
src/lib/Filesystem/Delta.php 1 patch
Spacing   +23 added lines, -23 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
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      *
99 99
      * @return array
100 100
      */
101
-    public function buildFeedFromCurrentState(?array $cursor = null, int $limit = 100, array $attributes = [], ?NodeInterface $node = null): array
101
+    public function buildFeedFromCurrentState(? array $cursor = null, int $limit = 100, array $attributes = [], ?NodeInterface $node = null) : array
102 102
     {
103 103
         $current_cursor = 0;
104 104
         $filter = ['$and' => [
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      *
169 169
      * @return array
170 170
      */
171
-    public function getLastRecord(?NodeInterface $node = null): ?array
171
+    public function getLastRecord(?NodeInterface $node = null) : ? array
172 172
     {
173 173
         $filter = $this->getDeltaFilter();
174 174
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      *
199 199
      * @return string
200 200
      */
201
-    public function getLastCursor(?NodeInterface $node = null): string
201
+    public function getLastCursor(?NodeInterface $node = null) : string
202 202
     {
203 203
         $filter = $this->getDeltaFilter();
204 204
 
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return array
233 233
      */
234
-    public function getDeltaFeed(?string $cursor = null, int $limit = 250, array $attributes = [], ?NodeInterface $node = null): array
234
+    public function getDeltaFeed(?string $cursor = null, int $limit = 250, array $attributes = [], ?NodeInterface $node = null) : array
235 235
     {
236 236
         $this->user->findNewShares();
237 237
 
238 238
         $attributes = array_merge(
239
-            ['id', 'directory', 'deleted',  'path', 'changed', 'created', 'owner'],
239
+            ['id', 'directory', 'deleted', 'path', 'changed', 'created', 'owner'],
240 240
             $attributes
241 241
         );
242 242
 
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
             }
267 267
 
268 268
             $result = $this->db->delta->find($filter, [
269
-                'skip' => (int) $cursor[1],
270
-                'limit' => (int) $limit,
269
+                'skip' => (int)$cursor[1],
270
+                'limit' => (int)$limit,
271 271
                 'sort' => ['timestamp' => 1],
272 272
             ]);
273 273
 
274 274
             $left = $this->db->delta->count($filter, [
275
-                'skip' => (int) $cursor[1],
275
+                'skip' => (int)$cursor[1],
276 276
                 'sort' => ['timestamp' => 1],
277 277
             ]);
278 278
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 
294 294
         foreach ($result as $log) {
295 295
             if (false === $has_more) {
296
-                $last_id = (string) $log['_id'];
297
-                $last_ts = (string) $log['timestamp'];
296
+                $last_id = (string)$log['_id'];
297
+                $last_ts = (string)$log['timestamp'];
298 298
             }
299 299
 
300 300
             try {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                     }
342 342
 
343 343
                     $deleted_node = [
344
-                        'id' => (string) $log['node'],
344
+                        'id' => (string)$log['node'],
345 345
                         'deleted' => true,
346 346
                         'created' => null,
347 347
                         'changed' => Helper::DateTimeToUnix($log['timestamp']),
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                     }
367 367
 
368 368
                     $entry = [
369
-                        'id' => (string) $log['node'],
369
+                        'id' => (string)$log['node'],
370 370
                         'deleted' => true,
371 371
                         'created' => null,
372 372
                         'changed' => Helper::DateTimeToUnix($log['timestamp']),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      *
405 405
      * @return array
406 406
      */
407
-    public function getEventLog(int $limit = 100, int $skip = 0, ?NodeInterface $node = null): array
407
+    public function getEventLog(int $limit = 100, int $skip = 0, ?NodeInterface $node = null) : array
408 408
     {
409 409
         $filter = $this->getDeltaFilter();
410 410
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
         $events = [];
433 433
         foreach ($result as $log) {
434
-            $id = (string) $log['_id'];
434
+            $id = (string)$log['_id'];
435 435
             $events[$id] = [
436 436
                 'event' => $id,
437 437
                 'timestamp' => Helper::DateTimeToUnix($log['timestamp']),
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
                         try {
454 454
                             $node = $this->fs->findNodeById($events[$id]['previous']['parent'], null, NodeInterface::DELETED_INCLUDE);
455 455
                             $events[$id]['previous']['parent'] = [
456
-                                'id' => (string) $node->getId(),
456
+                                'id' => (string)$node->getId(),
457 457
                                 'name' => $node->getName(),
458 458
                             ];
459 459
                         } catch (\Exception $e) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             try {
469 469
                 $node = $this->fs->findNodeById($log['node'], null, NodeInterface::DELETED_INCLUDE);
470 470
                 $events[$id]['node'] = [
471
-                    'id' => (string) $node->getId(),
471
+                    'id' => (string)$node->getId(),
472 472
                     'name' => $node->getName(),
473 473
                     'deleted' => $node->isDeleted(),
474 474
                 ];
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
                 } else {
486 486
                     $node = $this->fs->findNodeById($log['parent'], null, NodeInterface::DELETED_INCLUDE);
487 487
                     $events[$id]['parent'] = [
488
-                        'id' => (string) $node->getId(),
488
+                        'id' => (string)$node->getId(),
489 489
                         'name' => $node->getName(),
490 490
                         'deleted' => $node->isDeleted(),
491 491
                     ];
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             try {
498 498
                 $user = $this->fs->getServer()->getUserById($log['owner']);
499 499
                 $events[$id]['user'] = [
500
-                    'id' => (string) $user->getId(),
500
+                    'id' => (string)$user->getId(),
501 501
                     'username' => $user->getUsername(),
502 502
                 ];
503 503
             } catch (\Exception $e) {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
                 } else {
511 511
                     $node = $this->fs->findNodeById($log['share'], null, NodeInterface::DELETED_INCLUDE);
512 512
                     $events[$id]['share'] = [
513
-                        'id' => (string) $node->getId(),
513
+                        'id' => (string)$node->getId(),
514 514
                         'name' => $node->getName(),
515 515
                         'deleted' => $node->isDeleted(),
516 516
                     ];
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      *
547 547
      * @return array
548 548
      */
549
-    protected function decodeCursor(?string $cursor): ?array
549
+    protected function decodeCursor(?string $cursor) : ? array
550 550
     {
551 551
         if (null === $cursor) {
552 552
             return null;
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
         if (5 !== count($cursor)) {
562 562
             return null;
563 563
         }
564
-        $cursor[1] = (int) $cursor[1];
564
+        $cursor[1] = (int)$cursor[1];
565 565
 
566 566
         return $cursor;
567 567
     }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      * @return array
598 598
      */
599 599
     protected function findNodeAttributesWithCustomFilter(
600
-        ?array $filter = null,
600
+        ? array $filter = null,
601 601
         array $attributes = ['_id'],
602 602
         ?int $limit = null,
603 603
         ?int &$cursor = null,
Please login to merge, or discard this patch.
src/lib/Filesystem/Acl.php 1 patch
Spacing   +3 added lines, -3 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
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 return 'd';
127 127
             }
128 128
 
129
-            if ((string) $share['owner'] === (string) $user->getId()) {
129
+            if ((string)$share['owner'] === (string)$user->getId()) {
130 130
                 return 'rw';
131 131
             }
132 132
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
         $groups = [];
174 174
         foreach ($acl as $rule) {
175
-            if (self::TYPE_USER === $rule['type'] && $rule['id'] === (string) $user->getId()) {
175
+            if (self::TYPE_USER === $rule['type'] && $rule['id'] === (string)$user->getId()) {
176 176
                 $priv = $rule['privilege'];
177 177
             } elseif (self::TYPE_GROUP === $rule['type'] && in_array($rule['id'], $groups, true)) {
178 178
                 $priv = $rule['privilege'];
Please login to merge, or discard this patch.
src/lib/Server/User/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/lib/Server/Exception/NotAuthenticated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/lib/Server/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/lib/Server/Group/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/lib/Helper.php 1 patch
Spacing   +3 added lines, -3 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
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return stdClass
26 26
      */
27
-    public static function DateTimeToUnix(?UTCDateTime $date): ?stdClass
27
+    public static function DateTimeToUnix(?UTCDateTime $date) : ?stdClass
28 28
     {
29 29
         if (null === $date) {
30 30
             return null;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public static function isValidTimestamp(string $timestamp): bool
89 89
     {
90
-        return ((string) (int) $timestamp === $timestamp)
90
+        return ((string)(int)$timestamp === $timestamp)
91 91
             && ($timestamp <= PHP_INT_MAX)
92 92
             && ($timestamp >= ~PHP_INT_MAX);
93 93
     }
Please login to merge, or discard this patch.
src/app/Balloon.App.Convert/App/Http.php 1 patch
Spacing   +2 added lines, -2 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
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             ->prependRoute(new Route('/api/v1/file/convert', Convert::class))
37 37
             ->prependRoute(new Route('/api/v1/file/{id:#([0-9a-z]{24})#}/convert', Convert::class));
38 38
 
39
-        $decorator->addDecorator('master', function ($node, $attributes) use ($fs, $decorator) {
39
+        $decorator->addDecorator('master', function($node, $attributes) use ($fs, $decorator) {
40 40
             $master = $node->getAppAttribute('Balloon\\App\\Convert', 'master');
41 41
             if (null === $master) {
42 42
                 return null;
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Api/v1/Notification.php 1 patch
Spacing   +3 added lines, -3 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
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $body = [];
113 113
         foreach ($this->notifier->getNotifications($this->user) as $message) {
114 114
             $note = $message;
115
-            $note['id'] = (string) $note['_id'];
115
+            $note['id'] = (string)$note['_id'];
116 116
             unset($note['_id'], $note['receiver']);
117 117
 
118 118
             $note['sender'] = $this->server->getUserById($note['sender'])->getAttribute([
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     $this->notifier->subscribe($this->fs->getNode($id, $p), $subscribe);
252 252
                 } catch (\Exception $e) {
253 253
                     $failures[] = [
254
-                        'id' => (string) $node->getId(),
254
+                        'id' => (string)$node->getId(),
255 255
                         'name' => $node->getName(),
256 256
                         'error' => get_class($e),
257 257
                         'message' => $e->getMessage(),
Please login to merge, or discard this patch.