@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | 'category' => get_class($this), |
| 63 | 63 | ]); |
| 64 | 64 | |
| 65 | - $this->container->add(get_class($composer), function () use ($composer) { |
|
| 65 | + $this->container->add(get_class($composer), function() use ($composer) { |
|
| 66 | 66 | return $composer; |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | 69 | $container = $this->container; |
| 70 | - $this->container->add(Client::class, function () use ($container) { |
|
| 70 | + $this->container->add(Client::class, function() use ($container) { |
|
| 71 | 71 | return new Client($container->getParam(Client::class, 'uri'), [], [ |
| 72 | 72 | 'typeMap' => [ |
| 73 | 73 | 'root' => 'array', |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ]); |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | - $this->container->add(Database::class, function () use ($container) { |
|
| 80 | + $this->container->add(Database::class, function() use ($container) { |
|
| 81 | 81 | return $container->get(Client::class)->balloon; |
| 82 | 82 | }); |
| 83 | 83 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected function setErrorHandler(): self |
| 135 | 135 | { |
| 136 | - set_error_handler(function ($severity, $message, $file, $line) { |
|
| 136 | + set_error_handler(function($severity, $message, $file, $line) { |
|
| 137 | 137 | $log = $message.' in '.$file.':'.$line; |
| 138 | 138 | |
| 139 | 139 | if (null === $this->container) { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string $id |
| 157 | 157 | * @param string $name |
| 158 | 158 | */ |
| 159 | - public function getMember(?string $id = null, ?string $name = null): Response |
|
| 159 | + public function getMember(?string $id = null, ?string $name = null) : Response |
|
| 160 | 160 | { |
| 161 | 161 | $result = $this->_getGroup($id, $name)->getGroups(); |
| 162 | 162 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return Response |
| 197 | 197 | */ |
| 198 | - public function getAttributes(?string $id = null, ?string $name = null, array $attributes = []): Response |
|
| 198 | + public function getAttributes(?string $id = null, ?string $name = null, array $attributes = []) : Response |
|
| 199 | 199 | { |
| 200 | 200 | $result = $this->_getGroup($id, $name)->getAttribute($attributes); |
| 201 | 201 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return Response |
| 226 | 226 | */ |
| 227 | - public function head(?string $id = null, ?string $name = null): Response |
|
| 227 | + public function head(?string $id = null, ?string $name = null) : Response |
|
| 228 | 228 | { |
| 229 | 229 | $result = $this->_getGroup($id, $name, true); |
| 230 | 230 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | { |
| 267 | 267 | $id = $this->server->addGroup($name, $member, $attributes); |
| 268 | 268 | |
| 269 | - return (new Response())->setBody((string) $id)->setCode(201); |
|
| 269 | + return (new Response())->setBody((string)$id)->setCode(201); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return Response |
| 298 | 298 | */ |
| 299 | - public function postAttributes(array $attributes = [], ?string $id = null, ?string $name = null): Response |
|
| 299 | + public function postAttributes(array $attributes = [], ?string $id = null, ?string $name = null) : Response |
|
| 300 | 300 | { |
| 301 | 301 | $this->_getGroup($id, $name, true)->setAttribute($attributes)->save(array_keys($attributes)); |
| 302 | 302 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @return Response |
| 340 | 340 | */ |
| 341 | - public function delete(?string $id = null, ?string $name = null): Response |
|
| 341 | + public function delete(?string $id = null, ?string $name = null) : Response |
|
| 342 | 342 | { |
| 343 | 343 | $group = $this->_getGroup($id, $name, true); |
| 344 | 344 | $group->delete(); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * |
| 368 | 368 | * @return Response |
| 369 | 369 | */ |
| 370 | - public function postUndelete(?string $id = null, ?string $name = null): Response |
|
| 370 | + public function postUndelete(?string $id = null, ?string $name = null) : Response |
|
| 371 | 371 | { |
| 372 | 372 | $this->_getGroup($id, $name)->undelete(); |
| 373 | 373 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return Response |
| 45 | 45 | */ |
| 46 | - public function headChildren(?string $id = null, ?string $p = null): Response |
|
| 46 | + public function headChildren(?string $id = null, ?string $p = null) : Response |
|
| 47 | 47 | { |
| 48 | 48 | $result = $this->fs->getNode($id, $p, null, false, true); |
| 49 | 49 | $children = $result->getSize(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | int $deleted = 0, |
| 106 | 106 | array $filter = [], |
| 107 | 107 | array $attributes = [] |
| 108 | - ): Response { |
|
| 108 | + ) : Response { |
|
| 109 | 109 | $children = []; |
| 110 | 110 | $nodes = $this->fs->getNode($id, $p, null, false, true)->getChildNodes($deleted, $filter); |
| 111 | 111 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return Response |
| 157 | 157 | */ |
| 158 | - public function getShare(?string $id = null, ?string $p = null): Response |
|
| 158 | + public function getShare(?string $id = null, ?string $p = null) : Response |
|
| 159 | 159 | { |
| 160 | 160 | $result = $this->fs->getNode($id, $p)->getAcl(); |
| 161 | 161 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return Response |
| 206 | 206 | */ |
| 207 | - public function postShare(array $acl, ?string $id = null, ?string $p = null): Response |
|
| 207 | + public function postShare(array $acl, ?string $id = null, ?string $p = null) : Response |
|
| 208 | 208 | { |
| 209 | 209 | $node = $this->fs->getNode($id, $p); |
| 210 | 210 | $result = $node->share($acl); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @return Response |
| 242 | 242 | */ |
| 243 | - public function deleteShare(?string $id = null, ?string $p = null): Response |
|
| 243 | + public function deleteShare(?string $id = null, ?string $p = null) : Response |
|
| 244 | 244 | { |
| 245 | 245 | $node = $this->fs->getNode($id, $p); |
| 246 | 246 | $result = $node->unshare(); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | ?string $name = null, |
| 301 | 301 | array $attributes = [], |
| 302 | 302 | int $conflict = 0 |
| 303 | - ): Response { |
|
| 303 | + ) : Response { |
|
| 304 | 304 | if (null !== $p && null !== $name) { |
| 305 | 305 | throw new Exception\InvalidArgument('p and name can not be used at the same time'); |
| 306 | 306 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return Response |
| 157 | 157 | */ |
| 158 | - public function getIsAdmin(?string $uid = null, ?string $uname = null): Response |
|
| 158 | + public function getIsAdmin(?string $uid = null, ?string $uname = null) : Response |
|
| 159 | 159 | { |
| 160 | 160 | $result = $this->_getUser($uid, $uname)->isAdmin(); |
| 161 | 161 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @return Response |
| 194 | 194 | */ |
| 195 | - public function getWhoami(?string $uid = null, ?string $uname = null): Response |
|
| 195 | + public function getWhoami(?string $uid = null, ?string $uname = null) : Response |
|
| 196 | 196 | { |
| 197 | 197 | $result = $this->_getUser($uid, $uname)->getUsername(); |
| 198 | 198 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return Response |
| 233 | 233 | */ |
| 234 | - public function getNodeAttributeSummary(?string $uid = null, ?string $uname = null, array $attributes = [], int $limit = 25): Response |
|
| 234 | + public function getNodeAttributeSummary(?string $uid = null, ?string $uname = null, array $attributes = [], int $limit = 25) : Response |
|
| 235 | 235 | { |
| 236 | 236 | $result = $this->_getUser($uid, $uname)->getNodeAttributeSummary($attributes, $limit); |
| 237 | 237 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param string $uid |
| 270 | 270 | * @param string $uname |
| 271 | 271 | */ |
| 272 | - public function getGroups(?string $uid = null, ?string $uname = null): Response |
|
| 272 | + public function getGroups(?string $uid = null, ?string $uname = null) : Response |
|
| 273 | 273 | { |
| 274 | 274 | $result = $this->_getUser($uid, $uname)->getGroups(); |
| 275 | 275 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * |
| 310 | 310 | * @return Response |
| 311 | 311 | */ |
| 312 | - public function getShares(?string $uid = null, ?string $uname = null): Response |
|
| 312 | + public function getShares(?string $uid = null, ?string $uname = null) : Response |
|
| 313 | 313 | { |
| 314 | 314 | $result = $this->_getUser($uid, $uname)->getShares(); |
| 315 | 315 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @return Response |
| 357 | 357 | */ |
| 358 | - public function getQuotaUsage(?string $uid = null, ?string $uname = null): Response |
|
| 358 | + public function getQuotaUsage(?string $uid = null, ?string $uname = null) : Response |
|
| 359 | 359 | { |
| 360 | 360 | $result = $this->_getUser($uid, $uname)->getQuotaUsage(); |
| 361 | 361 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return Response |
| 396 | 396 | */ |
| 397 | - public function getAttributes(?string $uid = null, ?string $uname = null, array $attributes = []): Response |
|
| 397 | + public function getAttributes(?string $uid = null, ?string $uname = null, array $attributes = []) : Response |
|
| 398 | 398 | { |
| 399 | 399 | $result = $this->_getUser($uid, $uname)->getAttribute($attributes); |
| 400 | 400 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @return Response |
| 425 | 425 | */ |
| 426 | - public function head(?string $uid = null, ?string $uname = null): Response |
|
| 426 | + public function head(?string $uid = null, ?string $uname = null) : Response |
|
| 427 | 427 | { |
| 428 | 428 | $result = $this->_getUser($uid, $uname, true); |
| 429 | 429 | |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * |
| 465 | 465 | * @return Response |
| 466 | 466 | */ |
| 467 | - public function post(string $username, string $mail, ?string $namespace = null, ?string $password = null, int $hard_quota = 10000000, int $soft_quota = 10000000): Response |
|
| 467 | + public function post(string $username, string $mail, ?string $namespace = null, ?string $password = null, int $hard_quota = 10000000, int $soft_quota = 10000000) : Response |
|
| 468 | 468 | { |
| 469 | 469 | $id = $this->server->addUser($username, $password, [ |
| 470 | 470 | 'mail' => $mail, |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | 'soft_quota' => $soft_quota, |
| 474 | 474 | ]); |
| 475 | 475 | |
| 476 | - return (new Response())->setBody((string) $id)->setCode(201); |
|
| 476 | + return (new Response())->setBody((string)$id)->setCode(201); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | * |
| 504 | 504 | * @return Response |
| 505 | 505 | */ |
| 506 | - public function postAttributes(array $attributes = [], ?string $uid = null, ?string $uname = null): Response |
|
| 506 | + public function postAttributes(array $attributes = [], ?string $uid = null, ?string $uname = null) : Response |
|
| 507 | 507 | { |
| 508 | 508 | $this->_getUser($uid, $uname, true)->setAttribute($attributes)->save(array_keys($attributes)); |
| 509 | 509 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * |
| 547 | 547 | * @return Response |
| 548 | 548 | */ |
| 549 | - public function delete(?string $uid = null, ?string $uname = null, bool $force = false): Response |
|
| 549 | + public function delete(?string $uid = null, ?string $uname = null, bool $force = false) : Response |
|
| 550 | 550 | { |
| 551 | 551 | $user = $this->_getUser($uid, $uname, true); |
| 552 | 552 | |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * |
| 584 | 584 | * @return Response |
| 585 | 585 | */ |
| 586 | - public function postUndelete(?string $uid = null, ?string $uname = null): Response |
|
| 586 | + public function postUndelete(?string $uid = null, ?string $uname = null) : Response |
|
| 587 | 587 | { |
| 588 | 588 | $this->_getUser($uid, $uname, true)->undelete(); |
| 589 | 589 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | * |
| 550 | 550 | * @return bool |
| 551 | 551 | */ |
| 552 | - public function undelete(int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true): bool |
|
| 552 | + public function undelete(int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : bool |
|
| 553 | 553 | { |
| 554 | 554 | if (!$this->_acl->isAllowed($this, 'w')) { |
| 555 | 555 | throw new ForbiddenException( |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | public function getLastModified(): int |
| 658 | 658 | { |
| 659 | 659 | if ($this->changed instanceof UTCDateTime) { |
| 660 | - return (int) $this->changed->toDateTime()->format('U'); |
|
| 660 | + return (int)$this->changed->toDateTime()->format('U'); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | return 0; |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | public function getId(bool $string = false) |
| 672 | 672 | { |
| 673 | 673 | if (true === $string) { |
| 674 | - return (string) $this->_id; |
|
| 674 | + return (string)$this->_id; |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | return $this->_id; |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | * |
| 721 | 721 | * @return array |
| 722 | 722 | */ |
| 723 | - public function getParents(?NodeInterface $node = null, array $parents = []): array |
|
| 723 | + public function getParents(?NodeInterface $node = null, array $parents = []) : array |
|
| 724 | 724 | { |
| 725 | 725 | if (null === $node) { |
| 726 | 726 | $node = $this; |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | * |
| 763 | 763 | * @return bool |
| 764 | 764 | */ |
| 765 | - public function zip(ZipStream $archive, bool $self = true, ?NodeInterface $parent = null, string $path = '', int $depth = 0): bool |
|
| 765 | + public function zip(ZipStream $archive, bool $self = true, ?NodeInterface $parent = null, string $path = '', int $depth = 0) : bool |
|
| 766 | 766 | { |
| 767 | 767 | if (null === $parent) { |
| 768 | 768 | $parent = $this; |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | * |
| 1022 | 1022 | * @return bool |
| 1023 | 1023 | */ |
| 1024 | - public function setDestroyable(?UTCDateTime $ts): bool |
|
| 1024 | + public function setDestroyable(?UTCDateTime $ts) : bool |
|
| 1025 | 1025 | { |
| 1026 | 1026 | $this->destroy = $ts; |
| 1027 | 1027 | |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | * |
| 1090 | 1090 | * @return bool |
| 1091 | 1091 | */ |
| 1092 | - public function save($attributes = [], $remove = [], ?string $recursion = null, bool $recursion_first = true): bool |
|
| 1092 | + public function save($attributes = [], $remove = [], ?string $recursion = null, bool $recursion_first = true) : bool |
|
| 1093 | 1093 | { |
| 1094 | 1094 | if (!$this->_acl->isAllowed($this, 'w') && !$this->isReference()) { |
| 1095 | 1095 | throw new ForbiddenException( |
@@ -1102,8 +1102,8 @@ discard block |
||
| 1102 | 1102 | return false; |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | - $remove = (array) $remove; |
|
| 1106 | - $attributes = (array) $attributes; |
|
| 1105 | + $remove = (array)$remove; |
|
| 1106 | + $attributes = (array)$attributes; |
|
| 1107 | 1107 | $this->_hook->run( |
| 1108 | 1108 | 'preSaveNodeAttributes', |
| 1109 | 1109 | [$this, &$attributes, &$remove, &$recursion, &$recursion_first] |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | * |
| 1162 | 1162 | * @return string |
| 1163 | 1163 | */ |
| 1164 | - protected function getDuplicateName(?string $name = null): string |
|
| 1164 | + protected function getDuplicateName(?string $name = null) : string |
|
| 1165 | 1165 | { |
| 1166 | 1166 | if (null === $name) { |
| 1167 | 1167 | $name = $this->name; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return NodeInterface |
| 89 | 89 | */ |
| 90 | - public function copyTo(self $parent, int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true): NodeInterface |
|
| 90 | + public function copyTo(self $parent, int $conflict = NodeInterface::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : NodeInterface |
|
| 91 | 91 | { |
| 92 | 92 | if (null === $recursion) { |
| 93 | 93 | $recursion_first = true; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * |
| 402 | 402 | * @return bool |
| 403 | 403 | */ |
| 404 | - public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true): bool |
|
| 404 | + public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool |
|
| 405 | 405 | { |
| 406 | 406 | if (!$this->_acl->isAllowed($this, 'w') && !$this->isReference()) { |
| 407 | 407 | throw new ForbiddenException( |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | $node = $this->_db->storage->findOne($find); |
| 506 | 506 | |
| 507 | - return (bool) $node; |
|
| 507 | + return (bool)$node; |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | /** |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | * |
| 673 | 673 | * @return array |
| 674 | 674 | */ |
| 675 | - public function getChildrenRecursive(?ObjectId $id = null, ?array &$shares = [], ?array &$files = []): array |
|
| 675 | + public function getChildrenRecursive(?ObjectId $id = null, ? array &$shares = [], ? array &$files = []) : array |
|
| 676 | 676 | { |
| 677 | 677 | $list = []; |
| 678 | 678 | $result = $this->_db->storage->find([ |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | * |
| 973 | 973 | * @return bool |
| 974 | 974 | */ |
| 975 | - protected function _forceDelete(?string $recursion = null, bool $recursion_first = true): bool |
|
| 975 | + protected function _forceDelete(?string $recursion = null, bool $recursion_first = true) : bool |
|
| 976 | 976 | { |
| 977 | 977 | if (!$this->isReference()) { |
| 978 | 978 | $this->doRecursiveAction('delete', [ |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | - public function decorate(NodeInterface $node, ?array $attributes): array |
|
| 72 | + public function decorate(NodeInterface $node, ? array $attributes) : array |
|
| 73 | 73 | { |
| 74 | 74 | if (null === $attributes) { |
| 75 | 75 | $attributes = []; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return array |
| 117 | 117 | */ |
| 118 | - protected function prepare(NodeInterface $node, ?array $attributes): array |
|
| 118 | + protected function prepare(NodeInterface $node, ? array $attributes) : array |
|
| 119 | 119 | { |
| 120 | 120 | $clean = [ |
| 121 | 121 | 'attributes' => [], |
@@ -170,25 +170,25 @@ discard block |
||
| 170 | 170 | $server = $this->server; |
| 171 | 171 | |
| 172 | 172 | return [ |
| 173 | - 'id' => (string) $attributes['id'], |
|
| 174 | - 'name' => (string) $attributes['name'], |
|
| 175 | - 'mime' => (string) $attributes['mime'], |
|
| 176 | - 'readonly' => (bool) $attributes['readonly'], |
|
| 173 | + 'id' => (string)$attributes['id'], |
|
| 174 | + 'name' => (string)$attributes['name'], |
|
| 175 | + 'mime' => (string)$attributes['mime'], |
|
| 176 | + 'readonly' => (bool)$attributes['readonly'], |
|
| 177 | 177 | 'directory' => $node instanceof Collection, |
| 178 | - 'meta' => function ($node, $requested) { |
|
| 179 | - return (object) $node->getMetaAttribute([]); |
|
| 178 | + 'meta' => function($node, $requested) { |
|
| 179 | + return (object)$node->getMetaAttribute([]); |
|
| 180 | 180 | }, |
| 181 | - 'size' => function ($node, $requested) { |
|
| 181 | + 'size' => function($node, $requested) { |
|
| 182 | 182 | return $node->getSize(); |
| 183 | 183 | }, |
| 184 | - 'path' => function ($node, $requested) { |
|
| 184 | + 'path' => function($node, $requested) { |
|
| 185 | 185 | try { |
| 186 | 186 | return $node->getPath(); |
| 187 | 187 | } catch (\Exception $e) { |
| 188 | 188 | return null; |
| 189 | 189 | } |
| 190 | 190 | }, |
| 191 | - 'parent' => function ($node, $requested) { |
|
| 191 | + 'parent' => function($node, $requested) { |
|
| 192 | 192 | $parent = $node->getParent(); |
| 193 | 193 | |
| 194 | 194 | if (null === $parent || $parent->isRoot()) { |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | return $this->decorate($node->getParent(), $requested['parent']); |
| 199 | 199 | }, |
| 200 | - 'access' => function ($node, $requested) use ($acl) { |
|
| 200 | + 'access' => function($node, $requested) use ($acl) { |
|
| 201 | 201 | return $acl->getAclPrivilege($node); |
| 202 | 202 | }, |
| 203 | - 'owner' => function ($node, $requested) use ($server) { |
|
| 203 | + 'owner' => function($node, $requested) use ($server) { |
|
| 204 | 204 | try { |
| 205 | 205 | return $server->getUserById($node->getOwner())->getAttribute($requested['owner']); |
| 206 | 206 | } catch (\Exception $e) { |
@@ -221,20 +221,20 @@ discard block |
||
| 221 | 221 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
| 222 | 222 | { |
| 223 | 223 | return [ |
| 224 | - 'created' => function ($node, $requested) use ($attributes) { |
|
| 224 | + 'created' => function($node, $requested) use ($attributes) { |
|
| 225 | 225 | return Helper::DateTimeToUnix($attributes['created']); |
| 226 | 226 | }, |
| 227 | - 'changed' => function ($node, $requested) use ($attributes) { |
|
| 227 | + 'changed' => function($node, $requested) use ($attributes) { |
|
| 228 | 228 | return Helper::DateTimeToUnix($attributes['changed']); |
| 229 | 229 | }, |
| 230 | - 'deleted' => function ($node, $requested) use ($attributes) { |
|
| 230 | + 'deleted' => function($node, $requested) use ($attributes) { |
|
| 231 | 231 | if (false === $attributes['deleted']) { |
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | return Helper::DateTimeToUnix($attributes['deleted']); |
| 236 | 236 | }, |
| 237 | - 'destroy' => function ($node, $requested) use ($attributes) { |
|
| 237 | + 'destroy' => function($node, $requested) use ($attributes) { |
|
| 238 | 238 | if (false === $attributes['destroy']) { |
| 239 | 239 | return false; |
| 240 | 240 | } |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | return [ |
| 268 | 268 | 'shared' => $node->isShared(), |
| 269 | 269 | 'reference' => $node->isReference(), |
| 270 | - 'filter' => function ($node, $requested) use ($attributes) { |
|
| 270 | + 'filter' => function($node, $requested) use ($attributes) { |
|
| 271 | 271 | if (null === $attributes['filter']) { |
| 272 | 272 | return null; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return json_decode($attributes['filter']); |
| 276 | 276 | }, |
| 277 | - 'share' => function ($node, $requested) { |
|
| 277 | + 'share' => function($node, $requested) { |
|
| 278 | 278 | if ($node->isShare() || !$node->isSpecial()) { |
| 279 | 279 | return null; |
| 280 | 280 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | return null; |
| 286 | 286 | } |
| 287 | 287 | }, |
| 288 | - 'shareowner' => function ($node, $requested) use ($server, $fs) { |
|
| 288 | + 'shareowner' => function($node, $requested) use ($server, $fs) { |
|
| 289 | 289 | if ($node->isShare() || !$node->isSpecial()) { |
| 290 | 290 | return null; |
| 291 | 291 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return array |
| 100 | 100 | */ |
| 101 | - public function buildFeedFromCurrentState(?array $cursor = null, int $limit = 100, array $attributes = [], ?NodeInterface $node = null): array |
|
| 101 | + public function buildFeedFromCurrentState(? array $cursor = null, int $limit = 100, array $attributes = [], ?NodeInterface $node = null) : array |
|
| 102 | 102 | { |
| 103 | 103 | $current_cursor = 0; |
| 104 | 104 | $filter = ['$and' => [ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return array |
| 170 | 170 | */ |
| 171 | - public function getLastRecord(?NodeInterface $node = null): ?array |
|
| 171 | + public function getLastRecord(?NodeInterface $node = null) : ? array |
|
| 172 | 172 | { |
| 173 | 173 | $filter = $this->getDeltaFilter(); |
| 174 | 174 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function getLastCursor(?NodeInterface $node = null): string |
|
| 201 | + public function getLastCursor(?NodeInterface $node = null) : string |
|
| 202 | 202 | { |
| 203 | 203 | $filter = $this->getDeltaFilter(); |
| 204 | 204 | |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function getDeltaFeed(?string $cursor = null, int $limit = 250, array $attributes = [], ?NodeInterface $node = null): array |
|
| 234 | + public function getDeltaFeed(?string $cursor = null, int $limit = 250, array $attributes = [], ?NodeInterface $node = null) : array |
|
| 235 | 235 | { |
| 236 | 236 | $this->user->findNewShares(); |
| 237 | 237 | |
| 238 | 238 | $attributes = array_merge( |
| 239 | - ['id', 'directory', 'deleted', 'path', 'changed', 'created', 'owner'], |
|
| 239 | + ['id', 'directory', 'deleted', 'path', 'changed', 'created', 'owner'], |
|
| 240 | 240 | $attributes |
| 241 | 241 | ); |
| 242 | 242 | |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $result = $this->db->delta->find($filter, [ |
| 269 | - 'skip' => (int) $cursor[1], |
|
| 270 | - 'limit' => (int) $limit, |
|
| 269 | + 'skip' => (int)$cursor[1], |
|
| 270 | + 'limit' => (int)$limit, |
|
| 271 | 271 | 'sort' => ['timestamp' => 1], |
| 272 | 272 | ]); |
| 273 | 273 | |
| 274 | 274 | $left = $this->db->delta->count($filter, [ |
| 275 | - 'skip' => (int) $cursor[1], |
|
| 275 | + 'skip' => (int)$cursor[1], |
|
| 276 | 276 | 'sort' => ['timestamp' => 1], |
| 277 | 277 | ]); |
| 278 | 278 | |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | foreach ($result as $log) { |
| 295 | 295 | if (false === $has_more) { |
| 296 | - $last_id = (string) $log['_id']; |
|
| 297 | - $last_ts = (string) $log['timestamp']; |
|
| 296 | + $last_id = (string)$log['_id']; |
|
| 297 | + $last_ts = (string)$log['timestamp']; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | try { |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | $deleted_node = [ |
| 344 | - 'id' => (string) $log['node'], |
|
| 344 | + 'id' => (string)$log['node'], |
|
| 345 | 345 | 'deleted' => true, |
| 346 | 346 | 'created' => null, |
| 347 | 347 | 'changed' => Helper::DateTimeToUnix($log['timestamp']), |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $entry = [ |
| 369 | - 'id' => (string) $log['node'], |
|
| 369 | + 'id' => (string)$log['node'], |
|
| 370 | 370 | 'deleted' => true, |
| 371 | 371 | 'created' => null, |
| 372 | 372 | 'changed' => Helper::DateTimeToUnix($log['timestamp']), |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | * |
| 405 | 405 | * @return array |
| 406 | 406 | */ |
| 407 | - public function getEventLog(int $limit = 100, int $skip = 0, ?NodeInterface $node = null): array |
|
| 407 | + public function getEventLog(int $limit = 100, int $skip = 0, ?NodeInterface $node = null) : array |
|
| 408 | 408 | { |
| 409 | 409 | $filter = $this->getDeltaFilter(); |
| 410 | 410 | |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | $events = []; |
| 433 | 433 | foreach ($result as $log) { |
| 434 | - $id = (string) $log['_id']; |
|
| 434 | + $id = (string)$log['_id']; |
|
| 435 | 435 | $events[$id] = [ |
| 436 | 436 | 'event' => $id, |
| 437 | 437 | 'timestamp' => Helper::DateTimeToUnix($log['timestamp']), |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | try { |
| 454 | 454 | $node = $this->fs->findNodeById($events[$id]['previous']['parent'], null, NodeInterface::DELETED_INCLUDE); |
| 455 | 455 | $events[$id]['previous']['parent'] = [ |
| 456 | - 'id' => (string) $node->getId(), |
|
| 456 | + 'id' => (string)$node->getId(), |
|
| 457 | 457 | 'name' => $node->getName(), |
| 458 | 458 | ]; |
| 459 | 459 | } catch (\Exception $e) { |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | try { |
| 469 | 469 | $node = $this->fs->findNodeById($log['node'], null, NodeInterface::DELETED_INCLUDE); |
| 470 | 470 | $events[$id]['node'] = [ |
| 471 | - 'id' => (string) $node->getId(), |
|
| 471 | + 'id' => (string)$node->getId(), |
|
| 472 | 472 | 'name' => $node->getName(), |
| 473 | 473 | 'deleted' => $node->isDeleted(), |
| 474 | 474 | ]; |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | } else { |
| 486 | 486 | $node = $this->fs->findNodeById($log['parent'], null, NodeInterface::DELETED_INCLUDE); |
| 487 | 487 | $events[$id]['parent'] = [ |
| 488 | - 'id' => (string) $node->getId(), |
|
| 488 | + 'id' => (string)$node->getId(), |
|
| 489 | 489 | 'name' => $node->getName(), |
| 490 | 490 | 'deleted' => $node->isDeleted(), |
| 491 | 491 | ]; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | try { |
| 498 | 498 | $user = $this->fs->getServer()->getUserById($log['owner']); |
| 499 | 499 | $events[$id]['user'] = [ |
| 500 | - 'id' => (string) $user->getId(), |
|
| 500 | + 'id' => (string)$user->getId(), |
|
| 501 | 501 | 'username' => $user->getUsername(), |
| 502 | 502 | ]; |
| 503 | 503 | } catch (\Exception $e) { |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | } else { |
| 511 | 511 | $node = $this->fs->findNodeById($log['share'], null, NodeInterface::DELETED_INCLUDE); |
| 512 | 512 | $events[$id]['share'] = [ |
| 513 | - 'id' => (string) $node->getId(), |
|
| 513 | + 'id' => (string)$node->getId(), |
|
| 514 | 514 | 'name' => $node->getName(), |
| 515 | 515 | 'deleted' => $node->isDeleted(), |
| 516 | 516 | ]; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * |
| 547 | 547 | * @return array |
| 548 | 548 | */ |
| 549 | - protected function decodeCursor(?string $cursor): ?array |
|
| 549 | + protected function decodeCursor(?string $cursor) : ? array |
|
| 550 | 550 | { |
| 551 | 551 | if (null === $cursor) { |
| 552 | 552 | return null; |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | if (5 !== count($cursor)) { |
| 562 | 562 | return null; |
| 563 | 563 | } |
| 564 | - $cursor[1] = (int) $cursor[1]; |
|
| 564 | + $cursor[1] = (int)$cursor[1]; |
|
| 565 | 565 | |
| 566 | 566 | return $cursor; |
| 567 | 567 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * @return array |
| 598 | 598 | */ |
| 599 | 599 | protected function findNodeAttributesWithCustomFilter( |
| 600 | - ?array $filter = null, |
|
| 600 | + ? array $filter = null, |
|
| 601 | 601 | array $attributes = ['_id'], |
| 602 | 602 | ?int $limit = null, |
| 603 | 603 | ?int &$cursor = null, |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | return 'd'; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ((string) $share['owner'] === (string) $user->getId()) { |
|
| 129 | + if ((string)$share['owner'] === (string)$user->getId()) { |
|
| 130 | 130 | return 'rw'; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $groups = []; |
| 174 | 174 | foreach ($acl as $rule) { |
| 175 | - if (self::TYPE_USER === $rule['type'] && $rule['id'] === (string) $user->getId()) { |
|
| 175 | + if (self::TYPE_USER === $rule['type'] && $rule['id'] === (string)$user->getId()) { |
|
| 176 | 176 | $priv = $rule['privilege']; |
| 177 | 177 | } elseif (self::TYPE_GROUP === $rule['type'] && in_array($rule['id'], $groups, true)) { |
| 178 | 178 | $priv = $rule['privilege']; |