Completed
Branch dev (d5d70c)
by Raffael
11:00
created
src/app/Balloon.App.Office/Api/v2/Sessions.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
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 ->store();
98 98
 
99 99
         return (new Response())->setCode(201)->setBody([
100
-            'id' => (string) $session->getId(),
100
+            'id' => (string)$session->getId(),
101 101
             'wopi_url' => $this->app->getWopiUrl(),
102 102
             'access_token' => $member->getAccessToken(),
103 103
             'access_token_ttl' => ($member->getTTL()->toDateTime()->format('U') * 1000),
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 ->store();
139 139
 
140 140
         return (new Response())->setCode(200)->setBody([
141
-            'id' => (string) $session->getId(),
141
+            'id' => (string)$session->getId(),
142 142
             'wopi_url' => $this->app->getWopiUrl(),
143 143
             'access_token' => $member->getAccessToken(),
144 144
             'access_token_ttl' => ($member->getTTL()->toDateTime()->format('U') * 1000),
Please login to merge, or discard this patch.
src/app/Balloon.App.Office/Api/v1/Session.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
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         return (new Response())->setCode(201)->setBody([
103 103
             'code' => 201,
104 104
             'data' => [
105
-                'id' => (string) $session->getId(),
105
+                'id' => (string)$session->getId(),
106 106
                 'wopi_url' => $this->app->getWopiUrl(),
107 107
                 'access_token' => $member->getAccessToken(),
108 108
                 'access_token_ttl' => ($member->getTTL()->toDateTime()->format('U') * 1000),
Please login to merge, or discard this patch.
src/app/Balloon.App.Office/Api/v1/Document.php 1 patch
Spacing   +4 added lines, -4 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
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
         foreach ($document->getSessions() as $session) {
96 96
             $sessions[] = [
97
-                'id' => (string) $session['_id'],
97
+                'id' => (string)$session['_id'],
98 98
                 'created' => $session['_id']->getTimestamp(),
99 99
                 'user' => [
100
-                    'id' => (string) $session['user'],
100
+                    'id' => (string)$session['user'],
101 101
                     'name' => $this->server->getUserById($session['user'])->getUsername(),
102 102
                 ],
103 103
             ];
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         return (new Response())->setCode(201)->setBody([
172 172
             'code' => 201,
173
-            'data' => (string) $result->getId(),
173
+            'data' => (string)$result->getId(),
174 174
         ]);
175 175
     }
176 176
 }
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Nodes.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -280,52 +280,52 @@  discard block
 block discarded – undo
280 280
         }
281 281
 
282 282
         return $response
283
-          ->setOutputFormat(null)
284
-          ->setBody(function () use ($node, $encode, $offset, $length) {
285
-              $stream = $node->get();
286
-              $name = $node->getName();
283
+            ->setOutputFormat(null)
284
+            ->setBody(function () use ($node, $encode, $offset, $length) {
285
+                $stream = $node->get();
286
+                $name = $node->getName();
287 287
 
288
-              if (null === $stream) {
289
-                  echo '';
288
+                if (null === $stream) {
289
+                    echo '';
290 290
 
291
-                  return;
292
-              }
291
+                    return;
292
+                }
293 293
 
294
-              if (0 !== $offset) {
295
-                  if (fseek($stream, $offset) === -1) {
296
-                      throw new Exception\Conflict(
294
+                if (0 !== $offset) {
295
+                    if (fseek($stream, $offset) === -1) {
296
+                        throw new Exception\Conflict(
297 297
                         'invalid offset requested',
298 298
                         Exception\Conflict::INVALID_OFFSET
299 299
                     );
300
-                  }
301
-              }
302
-
303
-              $read = 0;
304
-              if ('base64' === $encode) {
305
-                  header('Content-Encoding: base64');
306
-                  while (!feof($stream)) {
307
-                      if (0 !== $length && $read + 8192 > $length) {
308
-                          echo base64_encode(fread($stream, $length - $read));
309
-                          exit();
310
-                      }
311
-
312
-                      echo base64_encode(fread($stream, 8192));
313
-                      $read += 8192;
314
-                  }
315
-              } else {
316
-                  while (!feof($stream)) {
317
-                      if (0 !== $length && $read + 8192 > $length) {
318
-                          echo fread($stream, $length - $read);
319
-                          exit();
320
-                      }
321
-
322
-                      echo fread($stream, 8192);
323
-                      $read += 8192;
324
-                  }
325
-
326
-                  exit();
327
-              }
328
-          });
300
+                    }
301
+                }
302
+
303
+                $read = 0;
304
+                if ('base64' === $encode) {
305
+                    header('Content-Encoding: base64');
306
+                    while (!feof($stream)) {
307
+                        if (0 !== $length && $read + 8192 > $length) {
308
+                            echo base64_encode(fread($stream, $length - $read));
309
+                            exit();
310
+                        }
311
+
312
+                        echo base64_encode(fread($stream, 8192));
313
+                        $read += 8192;
314
+                    }
315
+                } else {
316
+                    while (!feof($stream)) {
317
+                        if (0 !== $length && $read + 8192 > $length) {
318
+                            echo fread($stream, $length - $read);
319
+                            exit();
320
+                        }
321
+
322
+                        echo fread($stream, 8192);
323
+                        $read += 8192;
324
+                    }
325
+
326
+                    exit();
327
+                }
328
+            });
329 329
     }
330 330
 
331 331
     /**
@@ -1247,9 +1247,9 @@  discard block
 block discarded – undo
1247 1247
                 $node->zip($archive);
1248 1248
             } catch (\Exception $e) {
1249 1249
                 $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [
1250
-                   'category' => get_class($this),
1251
-                   'exception' => $e,
1252
-               ]);
1250
+                    'category' => get_class($this),
1251
+                    'exception' => $e,
1252
+                ]);
1253 1253
             }
1254 1254
         }
1255 1255
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $result = $this->_getNode($id, $p, null, false, false, $deleted);
124 124
 
125 125
             $response = (new Response())
126
-                ->setHeader('Content-Length', (string) $result->getSize())
126
+                ->setHeader('Content-Length', (string)$result->getSize())
127 127
                 ->setHeader('Content-Type', $result->getContentType())
128 128
                 ->setCode(200);
129 129
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             }
189 189
         }
190 190
 
191
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) {
191
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) {
192 192
             if (true === $move) {
193 193
                 $node = $node->setParent($parent, $conflict);
194 194
             }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             $response->setHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($node->getName()));
273 273
             $response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
274 274
             $response->setHeader('Content-Type', 'application/octet-stream');
275
-            $response->setHeader('Content-Length', (string) $node->getSize());
275
+            $response->setHeader('Content-Length', (string)$node->getSize());
276 276
             $response->setHeader('Content-Transfer-Encoding', 'binary');
277 277
         } else {
278 278
             $response->setHeader('Content-Disposition', 'inline; filename*=UTF-8\'\''.rawurlencode($node->getName()));
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
         return $response
283 283
           ->setOutputFormat(null)
284
-          ->setBody(function () use ($node, $encode, $offset, $length) {
284
+          ->setBody(function() use ($node, $encode, $offset, $length) {
285 285
               $stream = $node->get();
286 286
               $name = $node->getName();
287 287
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function postReadonly($id = null, $p = null, bool $readonly = true): Response
358 358
     {
359
-        return $this->bulk($id, $p, function ($node) use ($readonly) {
359
+        return $this->bulk($id, $p, function($node) use ($readonly) {
360 360
             $node->setReadonly($readonly);
361 361
 
362 362
             return ['code' => 204];
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      */
565 565
     public function patchMeta(array $attributes, ?string $id = null, ?string $p = null): Response
566 566
     {
567
-        return $this->bulk($id, $p, function ($node) use ($attributes) {
567
+        return $this->bulk($id, $p, function($node) use ($attributes) {
568 568
             $node->setMetaAttributes($attributes);
569 569
 
570 570
             return ['code' => 204];
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
             );
659 659
         }
660 660
 
661
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
661
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
662 662
             $parent = $node->getParent();
663 663
             $result = $node->copyTo($parent, $conflict);
664 664
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
             );
724 724
         }
725 725
 
726
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
726
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
727 727
             $result = $node->setParent($parent, $conflict);
728 728
 
729 729
             return [
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
             $at = $this->_verifyAttributes(['destroy' => $at])['destroy'];
778 778
         }
779 779
 
780
-        return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) {
780
+        return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) {
781 781
             if (null === $at) {
782 782
                 $node->delete($force && $node->isDeleted() || $force && $ignore_flag);
783 783
             } else {
@@ -1137,9 +1137,9 @@  discard block
 block discarded – undo
1137 1137
             $body = [];
1138 1138
             foreach ($this->_getNodes($id, $p) as $node) {
1139 1139
                 try {
1140
-                    $body[(string) $node->getId()] = $action->call($this, $node);
1140
+                    $body[(string)$node->getId()] = $action->call($this, $node);
1141 1141
                 } catch (\Exception $e) {
1142
-                    $body[(string) $node->getId()] = [
1142
+                    $body[(string)$node->getId()] = [
1143 1143
                         'code' => 400,
1144 1144
                         'data' => [
1145 1145
                             'error' => get_class($e),
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
         foreach ($attributes as $attribute => $value) {
1290 1290
             switch ($attribute) {
1291 1291
                 case 'filter':
1292
-                    $attributes['filter'] = json_encode((array) $attributes['filter']);
1292
+                    $attributes['filter'] = json_encode((array)$attributes['filter']);
1293 1293
 
1294 1294
                 break;
1295 1295
                 case 'destroy':
@@ -1304,14 +1304,14 @@  discard block
 block discarded – undo
1304 1304
                     if (!Helper::isValidTimestamp($value)) {
1305 1305
                         throw new Exception\InvalidArgument($attribute.' Changed timestamp must be valid unix timestamp');
1306 1306
                     }
1307
-                    if ((int) $value > time()) {
1307
+                    if ((int)$value > time()) {
1308 1308
                         throw new Exception\InvalidArgument($attribute.' timestamp can not be set greater than the server time');
1309 1309
                     }
1310 1310
                     $attributes[$attribute] = new UTCDateTime($value.'000');
1311 1311
 
1312 1312
                 break;
1313 1313
                 case 'readonly':
1314
-                    $attributes['readonly'] = (bool) $attributes['readonly'];
1314
+                    $attributes['readonly'] = (bool)$attributes['readonly'];
1315 1315
 
1316 1316
                 break;
1317 1317
             }
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Files.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
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             $wrote = fwrite($session_handler, $data);
303 303
             $tmp_size += $wrote;
304 304
 
305
-            if ($tmp_size > (int) $this->server->getMaxFileSize()) {
305
+            if ($tmp_size > (int)$this->server->getMaxFileSize()) {
306 306
                 fclose($input_handler);
307 307
                 fclose($session_handler);
308 308
                 unlink($file);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             }
345 345
         } else {
346 346
             return (new Response())->setCode(206)->setBody([
347
-                'session' => (string) $session,
347
+                'session' => (string)$session,
348 348
                 'size' => $tmp_size,
349 349
                 'chunks_left' => $chunks - $index,
350 350
             ]);
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/Node.php 1 patch
Spacing   +14 added lines, -14 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
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $result = $this->_getNode($id, $p, null, false, false, $deleted);
124 124
 
125 125
             $response = (new Response())
126
-                ->setHeader('Content-Length', (string) $result->getSize())
126
+                ->setHeader('Content-Length', (string)$result->getSize())
127 127
                 ->setHeader('Content-Type', $result->getContentType())
128 128
                 ->setCode(200);
129 129
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
         }
194 194
 
195
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) {
195
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) {
196 196
             if (true === $move) {
197 197
                 $node = $node->setParent($parent, $conflict);
198 198
             }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
         $node = $this->_getNode($id, $p);
275 275
         if ($node instanceof Collection) {
276
-            return (new Response())->setBody(function () use ($node) {
276
+            return (new Response())->setBody(function() use ($node) {
277 277
                 $node->getZip();
278 278
             });
279 279
         }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             $response->setHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($name));
285 285
             $response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
286 286
             $response->setHeader('Content-Type', 'application/octet-stream');
287
-            $response->setHeader('Content-Length', (string) $node->getSize());
287
+            $response->setHeader('Content-Length', (string)$node->getSize());
288 288
             $response->setHeader('Content-Transfer-Encoding', 'binary');
289 289
         } else {
290 290
             $response->setHeader('Content-Disposition', 'inline; filename*=UTF-8\'\''.rawurlencode($name));
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
         return (new Response())
294 294
           ->setOutputFormat(null)
295
-          ->setBody(function () use ($node, $encode, $offset, $length) {
295
+          ->setBody(function() use ($node, $encode, $offset, $length) {
296 296
               $mime = $node->getContentType();
297 297
               $stream = $node->get();
298 298
               $name = $node->getName();
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      */
366 366
     public function postReadonly($id = null, $p = null, bool $readonly = true): Response
367 367
     {
368
-        return $this->bulk($id, $p, function ($node) use ($readonly) {
368
+        return $this->bulk($id, $p, function($node) use ($readonly) {
369 369
             $node->setReadonly($readonly);
370 370
 
371 371
             return ['code' => 204];
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
      */
619 619
     public function postMetaAttributes(array $attributes, ?string $id = null, ?string $p = null): Response
620 620
     {
621
-        return $this->bulk($id, $p, function ($node) use ($attributes) {
621
+        return $this->bulk($id, $p, function($node) use ($attributes) {
622 622
             $node->setMetaAttributes($attributes);
623 623
 
624 624
             return ['code' => 204];
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
             );
707 707
         }
708 708
 
709
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
709
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
710 710
             $result = $node->copyTo($parent, $conflict);
711 711
 
712 712
             return [
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             );
771 771
         }
772 772
 
773
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
773
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
774 774
             $result = $node->setParent($parent, $conflict);
775 775
             if (NodeInterface::CONFLICT_RENAME === $conflict) {
776 776
                 return [
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
             $at = $this->_verifyAttributes(['destroy' => $at])['destroy'];
830 830
         }
831 831
 
832
-        return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) {
832
+        return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) {
833 833
             if (null === $at) {
834 834
                 $node->delete($force && $node->isDeleted() || $force && $ignore_flag);
835 835
             } else {
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
         foreach ($attributes as $attribute => $value) {
1426 1426
             switch ($attribute) {
1427 1427
                 case 'filter':
1428
-                    $attributes['filter'] = json_encode((array) $attributes['filter']);
1428
+                    $attributes['filter'] = json_encode((array)$attributes['filter']);
1429 1429
 
1430 1430
                 break;
1431 1431
                 case 'destroy':
@@ -1440,14 +1440,14 @@  discard block
 block discarded – undo
1440 1440
                     if (!Helper::isValidTimestamp($value)) {
1441 1441
                         throw new Exception\InvalidArgument($attribute.' Changed timestamp must be valid unix timestamp');
1442 1442
                     }
1443
-                    if ((int) $value > time()) {
1443
+                    if ((int)$value > time()) {
1444 1444
                         throw new Exception\InvalidArgument($attribute.' timestamp can not be set greater than the server time');
1445 1445
                     }
1446 1446
                     $attributes[$attribute] = new UTCDateTime($value.'000');
1447 1447
 
1448 1448
                 break;
1449 1449
                 case 'readonly':
1450
-                    $attributes['readonly'] = (bool) $attributes['readonly'];
1450
+                    $attributes['readonly'] = (bool)$attributes['readonly'];
1451 1451
 
1452 1452
                 break;
1453 1453
             }
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/AttributeDecorator/DeltaDecorator.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
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     protected function getAttributes(array $node): array
68 68
     {
69 69
         return [
70
-            'id' => (string) $node['id'],
70
+            'id' => (string)$node['id'],
71 71
             'deleted' => $node['deleted'],
72 72
             'changed' => $this->dateTimeToUnix($node['changed']),
73 73
             'path' => $node['path'],
Please login to merge, or discard this patch.
src/lib/Migration/Delta/v1AclTov2Acl.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
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                         $acl[] = [
56 56
                             'type' => 'group',
57 57
                             'privilege' => $rule['priv'] === 'w' ? 'w+' : $rule['priv'],
58
-                            'role' => (string) $group['_id'],
58
+                            'role' => (string)$group['_id'],
59 59
                         ];
60 60
                     }
61 61
                 }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                         $acl[] = [
75 75
                             'type' => 'user',
76 76
                             'privilege' => $rule['priv'] === 'w' ? 'w+' : $rule['priv'],
77
-                            'role' => (string) $user['_id'],
77
+                            'role' => (string)$user['_id'],
78 78
                         ];
79 79
                     }
80 80
                 }
Please login to merge, or discard this patch.
src/lib/Hook/AutoCreateUser.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         }
91 91
 
92 92
         $this->logger->info('found first time username ['.$identity->getIdentifier().'], auto-create user', [
93
-             'category' => get_class($this),
93
+                'category' => get_class($this),
94 94
         ]);
95 95
 
96 96
         $attributes = [];
Please login to merge, or discard this patch.