@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * Find raw node. |
183 | 183 | * |
184 | - * @param ObjectId $id |
|
184 | + * @param ObjectId|null $id |
|
185 | 185 | * |
186 | 186 | * @return array |
187 | 187 | */ |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param array $id |
304 | 304 | * @param string $class Force check node type |
305 | - * @param bool $deleted |
|
305 | + * @param integer $deleted |
|
306 | 306 | * |
307 | 307 | * @return Generator |
308 | 308 | */ |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @param string $class Force set node type |
432 | 432 | * @param bool $multiple Allow $id to be an array |
433 | 433 | * @param bool $allow_root Allow instance of root collection |
434 | - * @param bool $deleted How to handle deleted node |
|
434 | + * @param integer $deleted How to handle deleted node |
|
435 | 435 | * |
436 | 436 | * @return NodeInterface |
437 | 437 | */ |
@@ -493,7 +493,6 @@ discard block |
||
493 | 493 | * @param array $filter |
494 | 494 | * @param int $offset |
495 | 495 | * @param int $limit |
496 | - * @param int $total |
|
497 | 496 | * |
498 | 497 | * @return Generator |
499 | 498 | */ |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | /** |
270 | 270 | * Get real id (reference). |
271 | 271 | * |
272 | - * @return ObjectId |
|
272 | + * @return ObjectId|null |
|
273 | 273 | */ |
274 | 274 | public function getRealId(): ?ObjectId |
275 | 275 | { |
@@ -298,7 +298,6 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * Fetch children items of this collection. |
300 | 300 | * |
301 | - * @param string $node |
|
302 | 301 | * @param int $deleted |
303 | 302 | * @param array $filter |
304 | 303 | * @param mixed $name |
@@ -860,7 +859,7 @@ discard block |
||
860 | 859 | * @param string $name |
861 | 860 | * @param string $data |
862 | 861 | * |
863 | - * @return File |
|
862 | + * @return string |
|
864 | 863 | */ |
865 | 864 | public function createFile($name, $data = null): String |
866 | 865 | { |
@@ -885,7 +884,6 @@ discard block |
||
885 | 884 | * |
886 | 885 | * @param callable $callable |
887 | 886 | * @param int $deleted |
888 | - * @param bool $ignore_exception |
|
889 | 887 | * |
890 | 888 | * @return bool |
891 | 889 | */ |
@@ -16,7 +16,6 @@ |
||
16 | 16 | use Balloon\Filesystem\Acl\Exception\Forbidden as ForbiddenException; |
17 | 17 | use Balloon\Filesystem\Exception; |
18 | 18 | use Balloon\Hook; |
19 | -use Balloon\Server\User; |
|
20 | 19 | use Generator; |
21 | 20 | use MongoDB\BSON\ObjectId; |
22 | 21 | use MongoDB\BSON\Regex; |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $this->deleted = new UTCDateTime(); |
387 | 387 | |
388 | 388 | if (!$this->isReference()) { |
389 | - $this->doRecursiveAction(function ($node) use ($recursion) { |
|
389 | + $this->doRecursiveAction(function($node) use ($recursion) { |
|
390 | 390 | $node->delete(false, $recursion, false); |
391 | 391 | }, NodeInterface::DELETED_EXCLUDE); |
392 | 392 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | protected function _forceDelete(?string $recursion = null, bool $recursion_first = true): bool |
937 | 937 | { |
938 | 938 | if (!$this->isReference()) { |
939 | - $this->doRecursiveAction(function ($node) use ($recursion) { |
|
939 | + $this->doRecursiveAction(function($node) use ($recursion) { |
|
940 | 940 | $node->delete(true, $recursion, false); |
941 | 941 | }, NodeInterface::DELETED_INCLUDE); |
942 | 942 | } |
@@ -209,6 +209,7 @@ |
||
209 | 209 | /** |
210 | 210 | * Filesystem factory. |
211 | 211 | * |
212 | + * @param User $user |
|
212 | 213 | * @return Filesystem |
213 | 214 | */ |
214 | 215 | public function getFilesystem(?User $user = null): Filesystem |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | $this->identity = $user; |
533 | 533 | $user->updateIdentity($identity) |
534 | - ->updateShares(); |
|
534 | + ->updateShares(); |
|
535 | 535 | $this->hook->run('postServerIdentity', [$user]); |
536 | 536 | |
537 | 537 | return true; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | public function getGroupByName(string $name): Group |
663 | 663 | { |
664 | 664 | $group = $this->db->group->findOne([ |
665 | - 'name' => $name, |
|
665 | + 'name' => $name, |
|
666 | 666 | ]); |
667 | 667 | |
668 | 668 | if (null === $group) { |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | public function getGroupById(ObjectId $id): Group |
683 | 683 | { |
684 | 684 | $group = $this->db->group->findOne([ |
685 | - '_id' => $id, |
|
685 | + '_id' => $id, |
|
686 | 686 | ]); |
687 | 687 | |
688 | 688 | if (null === $group) { |
@@ -265,6 +265,8 @@ |
||
265 | 265 | /** |
266 | 266 | * Get resolved member. |
267 | 267 | * |
268 | + * @param integer $offset |
|
269 | + * @param integer $limit |
|
268 | 270 | * @return Generator |
269 | 271 | */ |
270 | 272 | public function getResolvedMembers(?int $offset = null, ?int $limit = null): ?Generator |
@@ -221,10 +221,10 @@ |
||
221 | 221 | { |
222 | 222 | $mail = new Message(); |
223 | 223 | $mail->setBody($body) |
224 | - ->setFrom($this->user->getAttributes()['mail'], $this->user->getAttributes()['username']) |
|
225 | - ->setSubject($subject) |
|
226 | - ->setTo($this->user->getAttributes()['mail'], 'Undisclosed Recipients') |
|
227 | - ->setBcc($receiver); |
|
224 | + ->setFrom($this->user->getAttributes()['mail'], $this->user->getAttributes()['username']) |
|
225 | + ->setSubject($subject) |
|
226 | + ->setTo($this->user->getAttributes()['mail'], 'Undisclosed Recipients') |
|
227 | + ->setBcc($receiver); |
|
228 | 228 | $this->async->addJob(Mail::class, $mail->toString()); |
229 | 229 | |
230 | 230 | return (new Response())->setCode(202); |
@@ -49,8 +49,8 @@ |
||
49 | 49 | $this->db->storage->updateOne( |
50 | 50 | ['_id' => $object['_id']], |
51 | 51 | [ |
52 | - '$unset' => ['sharelink' => 1], |
|
53 | - '$set' => ['app.Balloon\App\Sharelink' => $object['sharelink']], |
|
52 | + '$unset' => ['sharelink' => 1], |
|
53 | + '$set' => ['app.Balloon\App\Sharelink' => $object['sharelink']], |
|
54 | 54 | ] |
55 | 55 | ); |
56 | 56 | } |
@@ -279,50 +279,50 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | return $response |
282 | - ->setOutputFormat(null) |
|
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | - $stream = $node->get(); |
|
285 | - $name = $node->getName(); |
|
286 | - |
|
287 | - if (null === $stream) { |
|
288 | - return; |
|
289 | - } |
|
290 | - |
|
291 | - if (0 !== $offset) { |
|
292 | - if (fseek($stream, $offset) === -1) { |
|
293 | - throw new Exception\Conflict( |
|
282 | + ->setOutputFormat(null) |
|
283 | + ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | + $stream = $node->get(); |
|
285 | + $name = $node->getName(); |
|
286 | + |
|
287 | + if (null === $stream) { |
|
288 | + return; |
|
289 | + } |
|
290 | + |
|
291 | + if (0 !== $offset) { |
|
292 | + if (fseek($stream, $offset) === -1) { |
|
293 | + throw new Exception\Conflict( |
|
294 | 294 | 'invalid offset requested', |
295 | 295 | Exception\Conflict::INVALID_OFFSET |
296 | 296 | ); |
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - $read = 0; |
|
301 | - if ('base64' === $encode) { |
|
302 | - header('Content-Encoding: base64'); |
|
303 | - while (!feof($stream)) { |
|
304 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
305 | - echo base64_encode(fread($stream, $limit - $read)); |
|
306 | - exit(); |
|
307 | - } |
|
308 | - |
|
309 | - echo base64_encode(fread($stream, 8192)); |
|
310 | - $read += 8192; |
|
311 | - } |
|
312 | - } else { |
|
313 | - while (!feof($stream)) { |
|
314 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
315 | - echo fread($stream, $limit - $read); |
|
316 | - exit(); |
|
317 | - } |
|
318 | - |
|
319 | - echo fread($stream, 8192); |
|
320 | - $read += 8192; |
|
321 | - } |
|
322 | - |
|
323 | - exit(); |
|
324 | - } |
|
325 | - }); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + $read = 0; |
|
301 | + if ('base64' === $encode) { |
|
302 | + header('Content-Encoding: base64'); |
|
303 | + while (!feof($stream)) { |
|
304 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
305 | + echo base64_encode(fread($stream, $limit - $read)); |
|
306 | + exit(); |
|
307 | + } |
|
308 | + |
|
309 | + echo base64_encode(fread($stream, 8192)); |
|
310 | + $read += 8192; |
|
311 | + } |
|
312 | + } else { |
|
313 | + while (!feof($stream)) { |
|
314 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
315 | + echo fread($stream, $limit - $read); |
|
316 | + exit(); |
|
317 | + } |
|
318 | + |
|
319 | + echo fread($stream, 8192); |
|
320 | + $read += 8192; |
|
321 | + } |
|
322 | + |
|
323 | + exit(); |
|
324 | + } |
|
325 | + }); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | $node->zip($archive); |
1074 | 1074 | } catch (\Exception $e) { |
1075 | 1075 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1076 | - 'category' => get_class($this), |
|
1077 | - 'exception' => $e, |
|
1078 | - ]); |
|
1076 | + 'category' => get_class($this), |
|
1077 | + 'exception' => $e, |
|
1078 | + ]); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
190 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
191 | 191 | if (true === $move) { |
192 | 192 | $node = $node->setParent($parent, $conflict); |
193 | 193 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | return $response |
282 | 282 | ->setOutputFormat(null) |
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
283 | + ->setBody(function() use ($node, $encode, $offset, $limit) { |
|
284 | 284 | $stream = $node->get(); |
285 | 285 | $name = $node->getName(); |
286 | 286 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | return (new Response())->setCode(200)->setBody($result); |
430 | 430 | } |
431 | 431 | |
432 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
432 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
433 | 433 | return [ |
434 | 434 | 'code' => 200, |
435 | 435 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?string $id = null, ?string $p = null): Response |
544 | 544 | { |
545 | 545 | $attributes = compact('name', 'meta', 'readonly', 'filter'); |
546 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
546 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
547 | 547 | |
548 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
548 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
549 | 549 | foreach ($attributes as $attribute => $value) { |
550 | 550 | switch ($attribute) { |
551 | 551 | case 'name': |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ); |
628 | 628 | } |
629 | 629 | |
630 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
630 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
631 | 631 | $result = $node->copyTo($parent, $conflict); |
632 | 632 | |
633 | 633 | return [ |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | ); |
692 | 692 | } |
693 | 693 | |
694 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
694 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
695 | 695 | $result = $node->setParent($parent, $conflict); |
696 | 696 | |
697 | 697 | return [ |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
746 | 746 | } |
747 | 747 | |
748 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
748 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
749 | 749 | if (null === $at) { |
750 | 750 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
751 | 751 | } else { |
@@ -73,7 +73,6 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Constructor. |
75 | 75 | * |
76 | - * @param Database $db |
|
77 | 76 | * @param LoggerInterface $logger |
78 | 77 | */ |
79 | 78 | public function __construct(SocketFactory $factory, LoggerInterface $logger, ?Iterable $config = null) |
@@ -131,7 +130,7 @@ discard block |
||
131 | 130 | * |
132 | 131 | * @param File $file |
133 | 132 | * |
134 | - * @return array |
|
133 | + * @return File |
|
135 | 134 | */ |
136 | 135 | public function scan(File $file): array |
137 | 136 | { |
@@ -50,7 +50,6 @@ |
||
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 |