Completed
Push — master ( 5df7fb...58f05f )
by Raffael
15s
created
src/lib/Balloon/Filesystem/Node/Collection.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -13,11 +13,9 @@
 block discarded – undo
13 13
 
14 14
 use \Sabre\DAV;
15 15
 use Balloon\Exception;
16
-use Balloon\Helper;
17 16
 use Balloon\User;
18 17
 use Balloon\Resource;
19 18
 use \Psr\Log\LoggerInterface as Logger;
20
-use Balloon\Plugin;
21 19
 use Balloon\Filesystem;
22 20
 use \MongoDB\BSON\ObjectId;
23 21
 use \MongoDB\BSON\UTCDateTime;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     /**
349 349
      * Get real id (reference)
350 350
      *
351
-     * @return ObjectId
351
+     * @return ObjectId|null
352 352
      */
353 353
     public function getRealId(): ?ObjectId
354 354
     {
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
      *
1012 1012
      * @param   string $name
1013 1013
      * @param   string $data
1014
-     * @return  File
1014
+     * @return  string
1015 1015
      */
1016 1016
     public function createFile($name, $data=null): String
1017 1017
     {
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param  bool $force
74 74
      * @return void
75 75
      */
76
-    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force=false)
76
+    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force = false)
77 77
     {
78 78
         parent::__construct($node, $fs);
79 79
         
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
             $this->_id = null;
82 82
 
83 83
             if ($this->_user instanceof User) {
84
-                $this->owner  = $this->_user->getId();
84
+                $this->owner = $this->_user->getId();
85 85
             }
86 86
         }
87 87
             
88
-        if($force === false) {
88
+        if ($force === false) {
89 89
             $this->_verifyAccess();
90 90
         }
91 91
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param  bool $recursion_first
101 101
      * @return INode
102 102
      */
103
-    public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode
103
+    public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode
104 104
     {
105 105
         if ($recursion === null) {
106 106
             $recursion_first = true;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      * @param  array|string $attribute
200 200
      * @return array|string
201 201
      */
202
-    public function getAttribute($attribute=[])
202
+    public function getAttribute($attribute = [])
203 203
     {
204 204
         if (empty($attribute)) {
205 205
             $attribute = [
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @param   array $filter
246 246
      * @return  Generator
247 247
      */
248
-    public function getChildNodes(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): Generator
248
+    public function getChildNodes(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): Generator
249 249
     {
250 250
         if ($this->_user instanceof User) {
251 251
             $this->_user->findNewShares();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @param   array $filter
317 317
      * @return  Generator
318 318
      */
319
-    public function getChildren(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): array
319
+    public function getChildren(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): array
320 320
     {
321 321
         return iterator_to_array($this->getChildNodes($deleted, $filter));
322 322
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @param  array $filter
388 388
      * @return INode
389 389
      */
390
-    public function getChild($node, int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): INode
390
+    public function getChild($node, int $deleted = INode::DELETED_EXCLUDE, array $filter = []): INode
391 391
     {
392 392
         //if $node is string load the object from the backend based on the current parent (the name
393 393
         //is unique per depth, so we can load the object)
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      * @param   int $deleted
457 457
      * @return  bool
458 458
      */
459
-    protected function doRecursiveAction(string $method, array $params=[], int $deleted=INode::DELETED_EXCLUDE): bool
459
+    protected function doRecursiveAction(string $method, array $params = [], int $deleted = INode::DELETED_EXCLUDE): bool
460 460
     {
461 461
         if (!is_callable([$this, $method])) {
462 462
             throw new Exception("method $method is not callable in ".__CLASS__);
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
      * @param   bool $recursion_first
484 484
      * @return  bool
485 485
      */
486
-    public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool
486
+    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool
487 487
     {
488 488
         if (!$this->isAllowed('w') && !$this->isReference()) {
489 489
             throw new Exception\Forbidden('not allowed to delete node '.$this->name,
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      * @param   bool $recursion_first
547 547
      * @return  bool
548 548
      */
549
-    protected function _forceDelete(?string $recursion=null, bool $recursion_first=true): bool
549
+    protected function _forceDelete(?string $recursion = null, bool $recursion_first = true) : bool
550 550
     {
551 551
         if (!$this->isReference()) {
552 552
             $this->doRecursiveAction('delete', [
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
      * @param   array $filter
599 599
      * @return  bool
600 600
      */
601
-    public function childExists($name, $deleted=INode::DELETED_EXCLUDE, array $filter=[]): bool
601
+    public function childExists($name, $deleted = INode::DELETED_EXCLUDE, array $filter = []): bool
602 602
     {
603 603
         $find = [
604 604
             'parent'  => $this->getRealId(),
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
         }
733 733
 
734 734
         $this->shared = false;
735
-        $this->acl   = null;
735
+        $this->acl = null;
736 736
         $action = [
737 737
             '$unset' => [
738 738
                 'shared' => $this->_id
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
      * @param   arary $files
793 793
      * @return  array
794 794
      */
795
-    public function getChildrenRecursive(?ObjectId $id=null, ?array &$shares=[], ?array &$files=[]): array
795
+    public function getChildrenRecursive(?ObjectId $id = null, ? array &$shares = [], ? array &$files = []) : array
796 796
     {
797 797
         $list = [];
798 798
         $result = $this->_db->storage->find([
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
      * @param   bool $clone
837 837
      * @return  Collection
838 838
      */
839
-    public function addDirectory($name, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): Collection
839
+    public function addDirectory($name, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): Collection
840 840
     {
841 841
         if (!$this->isAllowed('w')) {
842 842
             throw new Exception\Forbidden('not allowed to create new node here',
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                 'shared'    => ($this->shared === true ? $this->getRealId() : $this->shared)
884 884
             ];
885 885
 
886
-            $save  = array_merge($meta, $attributes);
886
+            $save = array_merge($meta, $attributes);
887 887
 
888 888
             $result = $this->_db->storage->insertOne($save);
889 889
             $save['_id'] = $result->getInsertedId();
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      * @param   bool $clone
917 917
      * @return  File
918 918
      */
919
-    public function addFile($name, $data=null, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): File
919
+    public function addFile($name, $data = null, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): File
920 920
     {
921 921
         if (!$this->isAllowed('w')) {
922 922
             throw new Exception\Forbidden('not allowed to create new node here',
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                 'shared'    => ($this->shared === true ? $this->getRealId() : $this->shared),
967 967
             ];
968 968
 
969
-            $save  = array_merge($meta, $attributes);
969
+            $save = array_merge($meta, $attributes);
970 970
 
971 971
             $result = $this->_db->storage->insertOne($save);
972 972
             $save['_id'] = $result->getInsertedId();
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
      * @param   string $data
1017 1017
      * @return  File
1018 1018
      */
1019
-    public function createFile($name, $data=null): String
1019
+    public function createFile($name, $data = null): String
1020 1020
     {
1021 1021
         return $this->addFile($name, $data)->getETag();
1022 1022
     }
Please login to merge, or discard this patch.
src/lib/Balloon/Filesystem/Node/File.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -655,7 +655,6 @@
 block discarded – undo
655 655
     /**
656 656
      * Set thumbnail
657 657
      *
658
-     * @param  resource $thumbnail
659 658
      * @return ObjectId
660 659
      */
661 660
     protected function storePreview(string $content): ObjectId
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -14,10 +14,8 @@
 block discarded – undo
14 14
 use \Sabre\DAV;
15 15
 use Balloon\Exception;
16 16
 use Balloon\Helper;
17
-use Balloon\Queue;
18 17
 use Balloon\User;
19 18
 use \Psr\Log\LoggerInterface as Logger;
20
-use Balloon\Plugin;
21 19
 use Balloon\Filesystem;
22 20
 use \MongoDB\BSON\ObjectId;
23 21
 use \MongoDB\BSON\UTCDateTime;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             $v = (array)$version;
206 206
 
207 207
             $v['user'] = (new User($version['user'], $this->_logger, $this->_fs))
208
-              ->getUsername();
208
+                ->getUsername();
209 209
             $v['changed'] = Helper::DateTimeToUnix($version['changed']);
210 210
             $filtered[] = $v;
211 211
         }
@@ -597,15 +597,15 @@  discard block
 block discarded – undo
597 597
         $build = [];
598 598
         foreach ($requested as $key => $attr) {
599 599
             switch ($attr) {
600
-               case 'hash':
600
+                case 'hash':
601 601
                case 'version':
602 602
                case 'thumbnail':
603 603
                    $build[$attr] = $this->{$attr};
604
-               break;
604
+                break;
605 605
             
606
-               case 'history':
606
+                case 'history':
607 607
                    $build['history'] = $this->getHistory();
608
-               break;
608
+                break;
609 609
             }
610 610
         }
611 611
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
             //somehow mongo-connector does not catch metadata when set during uploadFromStream()
871 871
             $stream = $bucket->uploadFromStream($id, $contents, ['_id' => $id/*, 'metadata' => $file*/]);
872 872
             $this->_db->{'fs.files'}->updateOne(['_id' => $id], [
873
-              '$set' => ['metadata'=> $file]
873
+                '$set' => ['metadata'=> $file]
874 874
             ]);
875 875
             
876 876
             $this->_logger->info('added new gridfs content node ['.$id.'] for file ['.$this->_id.']', [
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      * @param array
48 48
      **/
49 49
     protected $temp_files = [
50
-        '/^\._(.*)$/',     // OS/X resource forks
51
-        '/^.DS_Store$/',   // OS/X custom folder settings
50
+        '/^\._(.*)$/', // OS/X resource forks
51
+        '/^.DS_Store$/', // OS/X custom folder settings
52 52
         '/^desktop.ini$/', // Windows custom folder settings
53
-        '/^Thumbs.db$/',   // Windows thumbnail cache
54
-        '/^.(.*).swpx$/',  // ViM temporary files
55
-        '/^.(.*).swx$/',   // ViM temporary files
56
-        '/^.(.*).swp$/',   // ViM temporary files
57
-        '/^\.dat(.*)$/',   // Smultron seems to create these
53
+        '/^Thumbs.db$/', // Windows thumbnail cache
54
+        '/^.(.*).swpx$/', // ViM temporary files
55
+        '/^.(.*).swx$/', // ViM temporary files
56
+        '/^.(.*).swp$/', // ViM temporary files
57
+        '/^\.dat(.*)$/', // Smultron seems to create these
58 58
         '/^~lock.(.*)#$/', // Windows 7 lockfiles
59 59
     ];
60 60
 
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
      * @param   bool $force
124 124
      * @return  void
125 125
      */
126
-    public function __construct(BSONDocument $node, Filesystem $fs, bool $force=false)
126
+    public function __construct(BSONDocument $node, Filesystem $fs, bool $force = false)
127 127
     {
128 128
         parent::__construct($node, $fs);
129 129
 
130
-        if($force === false) {
130
+        if ($force === false) {
131 131
             $this->_verifyAccess();
132 132
         }
133 133
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param  bool $recursion_first
164 164
      * @return INode
165 165
      */
166
-    public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode
166
+    public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode
167 167
     {
168 168
         $this->_pluginmgr->run('preCopyFile',
169 169
             [$this, $parent, &$conflict, &$recursion, &$recursion_first]
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      * @param   bool $recursion_first
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->isAllowed('w')) {
326 326
             throw new Exception\Forbidden('not allowed to delete node '.$this->name,
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         }
344 344
 
345 345
         $ts = new UTCDateTime();
346
-        $this->deleted  = $ts;
346
+        $this->deleted = $ts;
347 347
         $this->increaseVersion();
348 348
         
349 349
         $this->history[] = [
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                     return true;
439 439
                 }
440 440
 
441
-                $ref  = $file['metadata']['ref'];
441
+                $ref = $file['metadata']['ref'];
442 442
                 
443 443
                 $found = false;
444 444
                 foreach ($ref as $key => $node) {
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
      * @param  string|array $attribute
578 578
      * @return array|string
579 579
      */
580
-    public function getAttribute($attribute=[])
580
+    public function getAttribute($attribute = [])
581 581
     {
582 582
         if (empty($attribute)) {
583 583
             $attribute = [
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
     {
897 897
         assert(strlen($data) == 16);
898 898
 
899
-        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
900
-        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
899
+        $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100
900
+        $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10
901 901
 
902 902
         return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
903 903
     }
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
      * @param   array $attributes
922 922
      * @return  int
923 923
      */
924
-    public function put($file, bool $new=false, array $attributes=[]): int
924
+    public function put($file, bool $new = false, array $attributes = []): int
925 925
     {
926 926
         $this->_logger->debug('PUT new content data for ['.$this->_id.']', [
927 927
             'category' => get_class($this),
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
                 );
973 973
             }
974 974
 
975
-            $file  = $tmp_file;
975
+            $file = $tmp_file;
976 976
         }
977 977
         
978 978
        
@@ -1040,10 +1040,10 @@  discard block
 block discarded – undo
1040 1040
             $this->mime = $attributes['mime'];
1041 1041
         } elseif ($file !== null) {
1042 1042
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
1043
-            $this->mime  = finfo_file($finfo, $file);
1043
+            $this->mime = finfo_file($finfo, $file);
1044 1044
             if ($this->mime == 'application/zip' || $this->mime == 'application/vnd.ms-office') {
1045 1045
                 $mime = $this->getMimeTypeFromExtension($this->name);
1046
-                if($mime !== null) {
1046
+                if ($mime !== null) {
1047 1047
                     $this->mime = $mime;
1048 1048
                 }
1049 1049
             }
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
      * @param  string $db mimetypes
1137 1137
      * @return string
1138 1138
      */
1139
-    public function getMimeTypeFromExtension(string $filename, string $db='/etc/mime.types'): ?string
1139
+    public function getMimeTypeFromExtension(string $filename, string $db = '/etc/mime.types'): ?string
1140 1140
     {
1141 1141
         if (!is_readable($db)) {
1142 1142
             throw new Exception('mime database '.$db.' was not found or is not readable');
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
             if (substr($line, 0, 1) == '#') {
1154 1154
                 continue;
1155 1155
             } // skip comments
1156
-            $line = rtrim($line) . " ";
1156
+            $line = rtrim($line)." ";
1157 1157
             if (!preg_match($regex, $line, $matches)) {
1158 1158
                 continue;
1159 1159
             } // no match to the extension
Please login to merge, or discard this patch.
src/lib/Balloon/Filesystem/Node/Node.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -443,7 +443,6 @@  discard block
 block discarded – undo
443 443
     /**
444 444
      * Get share node
445 445
      *
446
-     * @param   bool $reference
447 446
      * @return  Collection
448 447
      */
449 448
     public function getShareNode(): ?Collection
@@ -1231,7 +1230,7 @@  discard block
 block discarded – undo
1231 1230
     /**
1232 1231
      * Get as zip
1233 1232
      *
1234
-     * @return void
1233
+     * @return resource
1235 1234
      */
1236 1235
     public function getZip(): void
1237 1236
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -893,7 +893,7 @@
 block discarded – undo
893 893
                 case 'shareowner':
894 894
                     if ($this->isSpecial() && $sharenode !== null) {
895 895
                         $build['shareowner'] = (new User($this->_fs->findRawNode($this->getShareId())['owner'],
896
-                          $this->_logger, $this->_fs)
896
+                            $this->_logger, $this->_fs)
897 897
                         )->getUsername();
898 898
                     }
899 899
                 break;
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      * @param  bool $force
223 223
      * @return void
224 224
      */
225
-    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force=false)
225
+    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force = false)
226 226
     {
227 227
         $this->_fs         = $fs;
228 228
         $this->_db         = $fs->getDatabase();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      *
271 271
      * @return mixed
272 272
      */
273
-    public function __call(string $attribute, array $params=[])
273
+    public function __call(string $attribute, array $params = [])
274 274
     {
275 275
         $prefix = 'get';
276 276
         $attr = strtolower(substr($attribute, 3));
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @param  int $conflict
316 316
      * @return INode
317 317
      */
318
-    public function setParent(Collection $parent, int $conflict=INode::CONFLICT_NOACTION): INode
318
+    public function setParent(Collection $parent, int $conflict = INode::CONFLICT_NOACTION): INode
319 319
     {
320 320
         if ($this->parent === $parent->getId()) {
321 321
             throw new Exception\Conflict('source node '.$this->name.' is already in the requested parent folder',
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      * @param   bool $recursion_first
391 391
      * @return  INode
392 392
      */
393
-    abstract public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode;
393
+    abstract public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode;
394 394
 
395 395
 
396 396
     /**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * @param   bool $reference
400 400
      * @return  ObjectId
401 401
      */
402
-    public function getShareId(bool $reference=false): ?ObjectId
402
+    public function getShareId(bool $reference = false): ?ObjectId
403 403
     {
404 404
         if ($this->isReference() && $reference === true) {
405 405
             return $this->_id;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      * @param   string $privilege
596 596
      * @return  bool
597 597
      */
598
-    public function isAllowed(string $privilege='r'): bool
598
+    public function isAllowed(string $privilege = 'r'): bool
599 599
     {
600 600
         $acl   = null;
601 601
         $share = null;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             $clean[] = 'meta';
790 790
         }
791 791
         
792
-        $attribute  = $clean;
792
+        $attribute = $clean;
793 793
 
794 794
         try {
795 795
             $sharenode  = $this->getShareNode();
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
      * @param   string $name
920 920
      * @return  string
921 921
      */
922
-    protected function _getDuplicateName(?string $name=null): string
922
+    protected function _getDuplicateName(?string $name = null) : string
923 923
     {
924 924
         if ($name === null) {
925 925
             $name = $this->name;
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
         if ($this instanceof Collection) {
929 929
             return $name.' ('.substr(uniqid('', true), -4).')';
930 930
         } else {
931
-            $ext  = substr(strrchr($name, '.'), 1);
931
+            $ext = substr(strrchr($name, '.'), 1);
932 932
 
933 933
             if ($ext === false) {
934 934
                 return $name.' ('.substr(uniqid('', true), -4).')';
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
      * @param   bool $recursion_first
949 949
      * @return  bool
950 950
      */
951
-    public function undelete(int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): bool
951
+    public function undelete(int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : bool
952 952
     {
953 953
         if (!$this->isAllowed('w')) {
954 954
             throw new Exception\Forbidden('not allowed to restore node '.$this->name,
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
             $recursion_first = false;
989 989
         }
990 990
 
991
-        $this->deleted  = false;
991
+        $this->deleted = false;
992 992
         
993 993
         if ($this instanceof File) {
994 994
             $current = $this->version;
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
      *
1143 1143
      * @return ObjectId|string
1144 1144
      */
1145
-    public function getId(bool $string=false)
1145
+    public function getId(bool $string = false)
1146 1146
     {
1147 1147
         if ($string === true) {
1148 1148
             return (string)$this->_id;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
      * @param   array $parents
1193 1193
      * @return  array
1194 1194
      */
1195
-    public function getParents(?INode $node=null, array $parents=[]): array
1195
+    public function getParents(?INode $node = null, array $parents = []) : array
1196 1196
     {
1197 1197
         if ($node === null) {
1198 1198
             $node = $this;
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
      * @param   int $depth
1260 1260
      * @return  bool
1261 1261
      */
1262
-    public function zip(ZipStream $archive, bool $self=true, ?INode $parent=null, string $path='', int $depth=0): bool
1262
+    public function zip(ZipStream $archive, bool $self = true, ?INode $parent = null, string $path = '', int $depth = 0) : bool
1263 1263
     {
1264 1264
         if ($parent === null) {
1265 1265
             $parent = $this;
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
      * @param   mixed $value
1322 1322
      * @return  INode
1323 1323
      */
1324
-    public function setMetaAttribute($attributes, $value=null): INode
1324
+    public function setMetaAttribute($attributes, $value = null): INode
1325 1325
     {
1326 1326
         $this->meta = self::validateMetaAttribute($attributes, $value, $this->meta);
1327 1327
         $this->save('meta');
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
      * @param   array $set
1338 1338
      * @return  array
1339 1339
      */
1340
-    public static function validateMetaAttribute($attributes, $value=null, array $set=[]): array
1340
+    public static function validateMetaAttribute($attributes, $value = null, array $set = []): array
1341 1341
     {
1342 1342
         if (is_string($attributes)) {
1343 1343
             $attributes = [
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
      * @param  string|array $attribute Specify attributes to return
1369 1369
      * @return string|array
1370 1370
      */
1371
-    public function getMetaAttribute($attribute=[])
1371
+    public function getMetaAttribute($attribute = [])
1372 1372
     {
1373 1373
         if (is_string($attribute)) {
1374 1374
             if (isset($this->meta[$attribute])) {
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
      * @param   bool $readonly
1389 1389
      * @return  bool
1390 1390
      */
1391
-    public function setReadonly(bool $readonly=true): bool
1391
+    public function setReadonly(bool $readonly = true): bool
1392 1392
     {
1393 1393
         $this->readonly = $readonly;
1394 1394
         return $this->save('readonly');
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
      * @param   UTCDateTime $ts
1402 1402
      * @return  bool
1403 1403
      */
1404
-    public function setDestroyable(?UTCDateTime $ts): bool
1404
+    public function setDestroyable(?UTCDateTime $ts) : bool
1405 1405
     {
1406 1406
         $this->destroy = $ts;
1407 1407
         
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
      * @param   string $recursion
1425 1425
      * @return  bool
1426 1426
      */
1427
-    abstract public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool;
1427
+    abstract public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool;
1428 1428
 
1429 1429
 
1430 1430
     /**
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
      * @param  bool $recursion_first
1495 1495
      * @return bool
1496 1496
      */
1497
-    public function save($attributes=[], $remove=[], ?string $recursion=null, bool $recursion_first=true): bool
1497
+    public function save($attributes = [], $remove = [], ?string $recursion = null, bool $recursion_first = true) : bool
1498 1498
     {
1499 1499
         if (!$this->isAllowed('w') && !$this->isReference()) {
1500 1500
             throw new Exception\Forbidden('not allowed to modify node '.$this->name,
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
             if (empty($update)) {
1528 1528
                 return false;
1529 1529
             } else {
1530
-                $result =$this->_db->storage->updateOne([
1530
+                $result = $this->_db->storage->updateOne([
1531 1531
                     '_id' => $this->_id,
1532 1532
                 ], $update);
1533 1533
             }
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
      * @return  array
1564 1564
      */
1565 1565
     public static function loadNodeAttributesWithCustomFilter(
1566
-        ?array $filter = null,
1566
+        ? array $filter = null,
1567 1567
         array $attributes = ['_id'],
1568 1568
         ?int $limit = null,
1569 1569
         ?int &$cursor = null,
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
         $search_attributes = array_merge($default, array_fill_keys($attributes, 1));
1581 1581
         $list   = [];
1582
-        $result =$this->_db->storage->find($filter, [
1582
+        $result = $this->_db->storage->find($filter, [
1583 1583
             'skip'      => $cursor,
1584 1584
             'limit'     => $limit,
1585 1585
             'projection'=> $search_attributes
Please login to merge, or discard this patch.
src/lib/Balloon/Helper.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * Convert UTCDateTime to unix ts
48 48
      *
49 49
      * @param  UTCDateTime $date
50
-     * @return StdClass
50
+     * @return null|\stdClass
51 51
      */
52 52
     public static function DateTimeToUnix(?UTCDateTime $date): ?Stdclass
53 53
     {
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
     /**
67 67
      * Search array element
68 68
      *
69
-     * @param   mixed $values
70
-     * @param   mixed $key
69
+     * @param   integer $value
70
+     * @param   string $key
71 71
      * @param   array $array
72
-     * @return  void
72
+     * @return  integer
73 73
      */
74 74
     public static function searchArray($value, $key, array $array)
75 75
     {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * Filter data
88 88
      *
89 89
      * @param  mixed $data
90
-     * @return mixed
90
+     * @return string
91 91
      */
92 92
     public static function filter($data)
93 93
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param  UTCDateTime $date
50 50
      * @return StdClass
51 51
      */
52
-    public static function DateTimeToUnix(?UTCDateTime $date): ?Stdclass
52
+    public static function DateTimeToUnix(?UTCDateTime $date) : ?Stdclass
53 53
     {
54 54
         if ($date === null) {
55 55
             return null;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public static function isValidTimeStamp(string $timestamp): bool
149 149
     {
150
-        return ((string) (int) $timestamp === $timestamp)
150
+        return ((string)(int)$timestamp === $timestamp)
151 151
             && ($timestamp <= PHP_INT_MAX)
152 152
             && ($timestamp >= ~PHP_INT_MAX);
153 153
     }
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Response.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     /**
170 170
      * Get body
171 171
      *
172
-     * @return mixed
172
+     * @return string
173 173
      */
174 174
     public function getBody()
175 175
     {
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     *
287 287
     * @param    mixed $data
288 288
     * @param    SimpleXMLElement $xml
289
-    * @param    string|int $child_name
289
+    * @param    string $child_name
290 290
     * @return   string
291 291
     */
292 292
     public function toXML($data, SimpleXMLElement $xml, $child_name): string
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     /**
354 354
      * Set the current output format.
355 355
      *
356
-     * @param  string $foramt a key of $outputForms
356
+     * @param  string $format a key of $outputForms
357 357
      * @return Response
358 358
      */
359 359
     public function setOutputFormat(string $format): Response
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 
14 14
 use Balloon\Http;
15 15
 use Balloon\Exception;
16
-use Balloon\Config\Xml;
17 16
 use \SimpleXMLElement;
18 17
 
19 18
 class Response
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -282,13 +282,13 @@
 block discarded – undo
282 282
 
283 283
 
284 284
     /**
285
-    * Converts mixed data to XML
286
-    *
287
-    * @param    mixed $data
288
-    * @param    SimpleXMLElement $xml
289
-    * @param    string|int $child_name
290
-    * @return   string
291
-    */
285
+     * Converts mixed data to XML
286
+     *
287
+     * @param    mixed $data
288
+     * @param    SimpleXMLElement $xml
289
+     * @param    string|int $child_name
290
+     * @return   string
291
+     */
292 292
     public function toXML($data, SimpleXMLElement $xml, $child_name): string
293 293
     {
294 294
         if (is_object($data)) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param  bool $body_only
159 159
      * @return Response
160 160
      */
161
-    public function setBody($body, bool $body_only=false): Response
161
+    public function setBody($body, bool $body_only = false): Response
162 162
     {
163 163
         $this->body = $body;
164 164
         $this->body_only = $body_only;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $this->sendHeaders();
188 188
         $status = Http::STATUS_CODES[$this->code];
189
-        header('HTTP/1.0 ' . $this->code . ' ' . $status, true, $this->code);
189
+        header('HTTP/1.0 '.$this->code.' '.$status, true, $this->code);
190 190
 
191 191
         if ($this->body === null && $this->code == 204) {
192 192
             $this->terminate();
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Router.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -304,7 +304,7 @@
 block discarded – undo
304 304
      * @param   string $class
305 305
      * @param   string $method
306 306
      * @param   array $parsed_params
307
-     * @return  array
307
+     * @return  callable
308 308
      */
309 309
     protected function getParams(string $class, string $method, array $parsed_params): array
310 310
     {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                     }
224 224
                 } else {
225 225
                     $this->logger->debug('requested path ['.$this->path.'] does not match route ['.$route->getPath().']', [
226
-                         'category' => get_class($this),
226
+                            'category' => get_class($this),
227 227
                     ]);
228 228
                 }
229 229
             }
@@ -267,22 +267,22 @@  discard block
 block discarded – undo
267 267
         ];
268 268
 
269 269
         switch (get_class($exception)) {
270
-           case 'Balloon\\Exception\\InvalidArgument':
270
+            case 'Balloon\\Exception\\InvalidArgument':
271 271
            case 'Balloon\\Exception\\Conflict':
272 272
                $code = 400;
273
-           break;
274
-           case 'Balloon\\Exception\\NotFound':
273
+            break;
274
+            case 'Balloon\\Exception\\NotFound':
275 275
                $code = 404;
276
-           break;
277
-           case 'Balloon\\Exception\\Forbidden':
276
+            break;
277
+            case 'Balloon\\Exception\\Forbidden':
278 278
                $code = 403;
279
-           break;
280
-           case 'Balloon\\Exception\\InsufficientStorage':
279
+            break;
280
+            case 'Balloon\\Exception\\InsufficientStorage':
281 281
                $code = 507;
282
-           break;
283
-           default:
282
+            break;
283
+            default:
284 284
               $code = 500;
285
-           break;
285
+            break;
286 286
         }
287 287
         
288 288
         $this->logger->error('uncaught exception '.$message.']', [
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param  array $constructor
197 197
      * @return bool
198 198
      */
199
-    public function run(array $constructor=[]): bool
199
+    public function run(array $constructor = []): bool
200 200
     {
201 201
         $this->logger->info('execute requested route ['.$this->path.']', [
202 202
             'category' => get_class($this),
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                 if (!empty($body)) {
320 320
                     $json_params = json_decode($body, true);
321 321
                 } else {
322
-                    $parts  = explode('&', $_SERVER['QUERY_STRING']);
322
+                    $parts = explode('&', $_SERVER['QUERY_STRING']);
323 323
                     if (!empty($parts)) {
324 324
                         $json_params = json_decode(urldecode($parts[0]), true);
325 325
                     }
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Router/Route.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
      * @param   string|object $class
72 72
      * @param   string $method
73 73
      * @param   array $params
74
-     * @return  void
74
+     * @return  Route
75 75
      */
76 76
     public function __construct(string $path, $class, ?string $method=null, array $params=[])
77 77
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,6 @@
 block discarded – undo
11 11
 
12 12
 namespace Balloon\Http\Router;
13 13
 
14
-use Balloon\Exception;
15 14
 use Balloon\Http\Router;
16 15
 
17 16
 class Route
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param   array $params
74 74
      * @return  void
75 75
      */
76
-    public function __construct(string $path, $class, ?string $method=null, array $params=[])
76
+    public function __construct(string $path, $class, ?string $method = null, array $params = [])
77 77
     {
78 78
         $this->setPath($path);
79 79
         $this->setClass($class);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function match(): bool
91 91
     {
92
-        $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function ($match) {
92
+        $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function($match) {
93 93
             if (count($match) === 4) {
94 94
                 return '(?<'.$match[2].'>'.$match[3].'+)';
95 95
             } else {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param  array $constructor
119 119
      * @return array
120 120
      */
121
-    public function getCallable($constructor=[]): array
121
+    public function getCallable($constructor = []): array
122 122
     {
123 123
         if (is_object($this->class)) {
124 124
             $instance = $this->class;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @param   string $name
141 141
      * @return  string
142 142
      */
143
-    protected function _buildMethodName(?string $name): string
143
+    protected function _buildMethodName(?string $name) : string
144 144
     {
145 145
         $result = $this->router->getVerb();
146 146
         
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @param   string $method
266 266
      * @return  Route
267 267
      */
268
-    public function setMethod(?string $method): Route
268
+    public function setMethod(?string $method) : Route
269 269
     {
270 270
         $this->method = $method;
271 271
         return $this;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      * @param  bool $next
314 314
      * @return Route
315 315
      */
316
-    public function continuePropagation($next=true): Route
316
+    public function continuePropagation($next = true): Route
317 317
     {
318 318
         $this->continue_propagation = (bool)$next;
319 319
         return $this;
Please login to merge, or discard this patch.
src/lib/Balloon/Log/Adapter/AbstractAdapter.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,6 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * Create adapter
51 51
      *
52
-     * @param Iterable $options
53 52
      * @return void
54 53
      */
55 54
     public function __construct(?Iterable $config=null)
@@ -92,7 +91,6 @@  discard block
 block discarded – undo
92 91
     /**
93 92
      * Set options
94 93
      *
95
-     * @param   Iterable $options
96 94
      * @return  AdapterInterface
97 95
      */
98 96
     public function setOptions(?Iterable $config=null): AdapterInterface
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param Iterable $options
53 53
      * @return void
54 54
      */
55
-    public function __construct(?Iterable $config=null)
55
+    public function __construct(?Iterable $config = null)
56 56
     {
57 57
         $this->setOptions($config);
58 58
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @param   Iterable $options
96 96
      * @return  AdapterInterface
97 97
      */
98
-    public function setOptions(?Iterable $config=null): AdapterInterface
98
+    public function setOptions(?Iterable $config = null) : AdapterInterface
99 99
     {
100 100
         if ($config === null) {
101 101
             return $this;
Please login to merge, or discard this patch.
src/lib/Balloon/Log/Adapter/AdapterInterface.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * Create adapter
29 29
      *
30
-     * @param Iterable $options
31 30
      * @return void
32 31
      */
33 32
     public function __construct(?Iterable $config=null);
@@ -58,7 +57,6 @@  discard block
 block discarded – undo
58 57
     /**
59 58
      * Set options
60 59
      *
61
-     * @param   Iterable $options
62 60
      * @return  AdapterInterface
63 61
      */
64 62
     public function setOptions(?Iterable $config=null): AdapterInterface;
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@
 block discarded – undo
11 11
 
12 12
 namespace Balloon\Log\Adapter;
13 13
 
14
-use Balloon\Exception;
15
-
16 14
 interface AdapterInterface
17 15
 {
18 16
     /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param Iterable $options
31 31
      * @return void
32 32
      */
33
-    public function __construct(?Iterable $config=null);
33
+    public function __construct(?Iterable $config = null);
34 34
     
35 35
 
36 36
     /**
@@ -61,5 +61,5 @@  discard block
 block discarded – undo
61 61
      * @param   Iterable $options
62 62
      * @return  AdapterInterface
63 63
      */
64
-    public function setOptions(?Iterable $config=null): AdapterInterface;
64
+    public function setOptions(?Iterable $config = null) : AdapterInterface;
65 65
 }
Please login to merge, or discard this patch.