Completed
Branch dev (276354)
by Raffael
15:43
created
src/app/Balloon.App.Office/Template.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,6 +85,6 @@
 block discarded – undo
85 85
     protected function getTemplate(): string
86 86
     {
87 87
         return __DIR__.DIRECTORY_SEPARATOR.'assets'
88
-          .DIRECTORY_SEPARATOR.'template.'.$this->type;
88
+            .DIRECTORY_SEPARATOR.'template.'.$this->type;
89 89
     }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
Please login to merge, or discard this patch.
src/app/Balloon.App.Preview/Hook.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
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.
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   +13 added lines, -13 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
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
      * @param array
45 45
      **/
46 46
     protected $temp_files = [
47
-        '/^\._(.*)$/',     // OS/X resource forks
48
-        '/^.DS_Store$/',   // OS/X custom folder settings
47
+        '/^\._(.*)$/', // OS/X resource forks
48
+        '/^.DS_Store$/', // OS/X custom folder settings
49 49
         '/^desktop.ini$/', // Windows custom folder settings
50
-        '/^Thumbs.db$/',   // Windows thumbnail cache
51
-        '/^.(.*).swpx$/',  // ViM temporary files
52
-        '/^.(.*).swx$/',   // ViM temporary files
53
-        '/^.(.*).swp$/',   // ViM temporary files
54
-        '/^\.dat(.*)$/',   // Smultron seems to create these
50
+        '/^Thumbs.db$/', // Windows thumbnail cache
51
+        '/^.(.*).swpx$/', // ViM temporary files
52
+        '/^.(.*).swx$/', // ViM temporary files
53
+        '/^.(.*).swp$/', // ViM temporary files
54
+        '/^\.dat(.*)$/', // Smultron seems to create these
55 55
         '/^~lock.(.*)#$/', // Windows 7 lockfiles
56 56
     ];
57 57
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         }
544 544
 
545 545
         $this->hash = $new_hash;
546
-        $max = (int) (string) $this->_fs->getServer()->getMaxFileVersion();
546
+        $max = (int)(string)$this->_fs->getServer()->getMaxFileVersion();
547 547
         if (count($this->history) >= $max) {
548 548
             $del = key($this->history);
549 549
             $this->_logger->debug('history limit ['.$max.'] reached, remove oldest version ['.$del.'] from file ['.$this->_id.']', [
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
     {
638 638
         assert(16 === strlen($data));
639 639
 
640
-        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
641
-        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
640
+        $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100
641
+        $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10
642 642
 
643 643
         return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
644 644
     }
@@ -741,11 +741,11 @@  discard block
 block discarded – undo
741 741
 
742 742
             $tmp_file = $tmp.DIRECTORY_SEPARATOR.$this->guidv4(openssl_random_pseudo_bytes(16));
743 743
             $stream = fopen($tmp_file, 'w+');
744
-            $size = stream_copy_to_stream($file, $stream, ((int) $this->_fs->getServer()->getMaxFileSize() + 1));
744
+            $size = stream_copy_to_stream($file, $stream, ((int)$this->_fs->getServer()->getMaxFileSize() + 1));
745 745
             rewind($stream);
746 746
             fclose($file);
747 747
 
748
-            if ($size > (int) $this->_fs->getServer()->getMaxFileSize()) {
748
+            if ($size > (int)$this->_fs->getServer()->getMaxFileSize()) {
749 749
                 unlink($tmp_file);
750 750
 
751 751
                 throw new Exception\InsufficientStorage(
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use Balloon\Filesystem\Storage;
19 19
 use Balloon\Hook;
20 20
 use Balloon\Mime;
21
-use Balloon\Server\User;
22 21
 use MongoDB\BSON\UTCDateTime;
23 22
 use Psr\Log\LoggerInterface;
24 23
 use Sabre\DAV\IFile;
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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
Please login to merge, or discard this patch.
src/app/Balloon.App.Elasticsearch/Job.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     /**
76 76
      * Constructor.
77 77
      *
78
-     * @param Elasticsarch           $es
78
+     * @param Elasticsearch           $es
79 79
      * @param Storage                $storage
80 80
      * @param Server                 $server
81 81
      * @param NodeAttributeDecorator $decorator
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
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         foreach ($config as $option => $value) {
111 111
             switch ($option) {
112 112
                 case 'size_limit':
113
-                    $this->size_limit = (int) $value;
113
+                    $this->size_limit = (int)$value;
114 114
 
115 115
                 break;
116 116
                 default:
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         ]);
219 219
 
220 220
         $params = [
221
-            'id' => (string) $node,
221
+            'id' => (string)$node,
222 222
             'type' => 'storage',
223 223
             'index' => $this->es->getIndex(),
224 224
         ];
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         ]);
244 244
 
245 245
         $params = [
246
-            'id' => (string) $node,
246
+            'id' => (string)$node,
247 247
             'type' => 'storage',
248 248
             'index' => $this->es->getIndex(),
249 249
         ];
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
      */
265 265
     protected function setMemoryLimit(): self
266 266
     {
267
-        $limit = (int) ini_get('memory_limit') * 1024 * 1024;
267
+        $limit = (int)ini_get('memory_limit') * 1024 * 1024;
268 268
         $required = $this->size_limit * 2;
269 269
         if ($limit !== -1 && $limit < $limit + $required) {
270
-            ini_set('memory_limit', (string) (($limit + $required) * 1024 * 1024));
270
+            ini_set('memory_limit', (string)(($limit + $required) * 1024 * 1024));
271 271
         }
272 272
 
273 273
         return $this;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     {
285 285
         return [
286 286
             'index' => $this->es->getIndex(),
287
-            'id' => (string) $node->getId(),
287
+            'id' => (string)$node->getId(),
288 288
             'type' => 'storage',
289 289
         ];
290 290
     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         $params = [
303 303
             'index' => $this->es->getIndex(),
304
-            'id' => (string) $storage_reference['_id'],
304
+            'id' => (string)$storage_reference['_id'],
305 305
             'type' => 'fs',
306 306
         ];
307 307
 
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
         $content = base64_encode(stream_get_contents($node->get()));
344 344
 
345 345
         $metadata = $meta['metadata'];
346
-        array_walk_recursive($metadata, function (&$value) { $value = (string) $value; });
346
+        array_walk_recursive($metadata, function(&$value) { $value = (string)$value; });
347 347
 
348 348
         $params = [
349 349
             'index' => $this->es->getIndex(),
350
-            'id' => (string) $meta['_id'],
350
+            'id' => (string)$meta['_id'],
351 351
             'type' => 'fs',
352 352
             'body' => [
353 353
                 'metadata' => $metadata,
Please login to merge, or discard this patch.
src/lib/Console.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     /**
174 174
      * Configure cli logger.
175 175
      *
176
-     * @return Cli
176
+     * @return Console
177 177
      */
178 178
     protected function configureLogger(?int $level = null): self
179 179
     {
@@ -264,7 +264,6 @@  discard block
 block discarded – undo
264 264
     /**
265 265
      * Start.
266 266
      *
267
-     * @param array $options
268 267
      *
269 268
      * @return bool
270 269
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
Please login to merge, or discard this patch.
src/lib/Console/Jobs.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,6 @@
 block discarded – undo
50 50
     /**
51 51
      * Constructor.
52 52
      *
53
-     * @param App             $app
54 53
      * @param Async           $async
55 54
      * @param LoggerInterface $logger
56 55
      * @param GetOpt          $getopt
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
Please login to merge, or discard this patch.
src/lib/Filesystem/Node/AttributeDecorator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
      *
61 61
      * @param Server    $server
62 62
      * @param Acl       $acl
63
-     * @param Decorator $role_decorator
63
+     * @param RoleAttributeDecorator $role_decorator
64 64
      */
65 65
     public function __construct(Server $server, Acl $acl, RoleAttributeDecorator $role_decorator)
66 66
     {
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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
@@ -125,25 +125,25 @@  discard block
 block discarded – undo
125 125
         $decorator = $this->role_decorator;
126 126
 
127 127
         return [
128
-            'id' => (string) $attributes['_id'],
129
-            'name' => (string) $attributes['name'],
130
-            'mime' => (string) $attributes['mime'],
131
-            'readonly' => (bool) $attributes['readonly'],
128
+            'id' => (string)$attributes['_id'],
129
+            'name' => (string)$attributes['name'],
130
+            'mime' => (string)$attributes['mime'],
131
+            'readonly' => (bool)$attributes['readonly'],
132 132
             'directory' => $node instanceof Collection,
133
-            'meta' => function ($node) {
134
-                return (object) $node->getMetaAttributes();
133
+            'meta' => function($node) {
134
+                return (object)$node->getMetaAttributes();
135 135
             },
136
-            'size' => function ($node) {
136
+            'size' => function($node) {
137 137
                 return $node->getSize();
138 138
             },
139
-            'path' => function ($node) {
139
+            'path' => function($node) {
140 140
                 try {
141 141
                     return $node->getPath();
142 142
                 } catch (\Exception $e) {
143 143
                     return null;
144 144
                 }
145 145
             },
146
-            'parent' => function ($node) {
146
+            'parent' => function($node) {
147 147
                 $parent = $node->getParent();
148 148
 
149 149
                 if (null === $parent || $parent->isRoot()) {
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 
153 153
                 return $this->decorate($node->getParent(), ['id', 'name', '_links']);
154 154
             },
155
-            'access' => function ($node) use ($acl) {
155
+            'access' => function($node) use ($acl) {
156 156
                 return $acl->getAclPrivilege($node);
157 157
             },
158
-            'share' => function ($node) {
158
+            'share' => function($node) {
159 159
                 if ($node->isShared() || !$node->isSpecial()) {
160 160
                     return null;
161 161
                 }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     return null;
167 167
                 }
168 168
             },
169
-            'sharename' => function ($node) {
169
+            'sharename' => function($node) {
170 170
                 if (!$node->isShared()) {
171 171
                     return null;
172 172
                 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                     return null;
178 178
                 }
179 179
             },
180
-            'shareowner' => function ($node) use ($server, $fs, $decorator) {
180
+            'shareowner' => function($node) use ($server, $fs, $decorator) {
181 181
                 if (!$node->isSpecial()) {
182 182
                     return null;
183 183
                 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                     return null;
192 192
                 }
193 193
             },
194
-            'owner' => function ($node) use ($server, $decorator) {
194
+            'owner' => function($node) use ($server, $decorator) {
195 195
                 try {
196 196
                     return $decorator->decorate(
197 197
                         $server->getUserById($node->getOwner()),
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
     protected function getTimeAttributes(NodeInterface $node, array $attributes): array
216 216
     {
217 217
         return [
218
-            'created' => function ($node) use ($attributes) {
218
+            'created' => function($node) use ($attributes) {
219 219
                 return $attributes['created']->toDateTime()->format('c');
220 220
             },
221
-            'changed' => function ($node) use ($attributes) {
221
+            'changed' => function($node) use ($attributes) {
222 222
                 return $attributes['changed']->toDateTime()->format('c');
223 223
             },
224
-            'deleted' => function ($node) use ($attributes) {
224
+            'deleted' => function($node) use ($attributes) {
225 225
                 if (false === $attributes['deleted']) {
226 226
                     return null;
227 227
                 }
228 228
 
229 229
                 return $attributes['deleted']->toDateTime()->format('c');
230 230
             },
231
-            'destroy' => function ($node) use ($attributes) {
231
+            'destroy' => function($node) use ($attributes) {
232 232
                 if (null === $attributes['destroy']) {
233 233
                     return null;
234 234
                 }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         return [
262 262
             'shared' => $node->isShared(),
263 263
             'reference' => $node->isReference(),
264
-            'filter' => function ($node) use ($attributes) {
264
+            'filter' => function($node) use ($attributes) {
265 265
                 if (null === $attributes['filter']) {
266 266
                     return null;
267 267
                 }
Please login to merge, or discard this patch.
src/app/Balloon.App.Office/Session/Member.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
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
             'BaseFileName' => $attrs['name'],
141 141
             'Size' => $doc->getSize(),
142 142
             'Version' => $attrs['version'],
143
-            'OwnerId' => (string) $doc->getNode()->getOwner(),
144
-            'UserId' => (string) $this->user->getId(),
143
+            'OwnerId' => (string)$doc->getNode()->getOwner(),
144
+            'UserId' => (string)$this->user->getId(),
145 145
             'UserFriendlyName' => $this->user->getUsername(),
146 146
             'UserCanWrite' => true,
147 147
             'PostMessageOrigin' => null,
Please login to merge, or discard this patch.