@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | protected function addShare(Collection $collection): bool |
| 272 | 272 | { |
| 273 | 273 | $that = $this; |
| 274 | - $collection->doRecursiveAction(function ($node) use ($that) { |
|
| 274 | + $collection->doRecursiveAction(function($node) use ($that) { |
|
| 275 | 275 | if ($node instanceof Collection) { |
| 276 | 276 | $that->addShare($node); |
| 277 | 277 | } else { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | protected function deleteShare(Collection $collection): bool |
| 293 | 293 | { |
| 294 | 294 | $that = $this; |
| 295 | - $collection->doRecursiveAction(function ($node) use ($that) { |
|
| 295 | + $collection->doRecursiveAction(function($node) use ($that) { |
|
| 296 | 296 | if ($node instanceof Collection) { |
| 297 | 297 | $that->deleteShare($node); |
| 298 | 298 | } else { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct(AttributeDecorator $decorator) |
| 26 | 26 | { |
| 27 | - $decorator->addDecorator('malware_quarantine', function ($node) { |
|
| 27 | + $decorator->addDecorator('malware_quarantine', function($node) { |
|
| 28 | 28 | if ($node instanceof File) { |
| 29 | 29 | $quarantine = $node->getAppAttribute('Balloon\\App\\ClamAv', 'quarantine'); |
| 30 | 30 | if (is_bool($quarantine)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | }); |
| 35 | - $decorator->addDecorator('malware_scantime', function ($node) { |
|
| 35 | + $decorator->addDecorator('malware_scantime', function($node) { |
|
| 36 | 36 | if ($node instanceof File) { |
| 37 | 37 | $ts = $node->getAppAttribute('Balloon\\App\\ClamAv', 'scantime'); |
| 38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | }); |
| 44 | - $decorator->addDecorator('malware_reason', function ($node) { |
|
| 44 | + $decorator->addDecorator('malware_reason', function($node) { |
|
| 45 | 45 | if ($node instanceof File) { |
| 46 | 46 | return $node->getAppAttribute('Balloon\\App\\ClamAv', 'reason'); |
| 47 | 47 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $attributes = compact('namespace', 'optional'); |
| 273 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 273 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 274 | 274 | |
| 275 | 275 | $id = $this->server->addGroup($name, $member, $attributes); |
| 276 | 276 | $result = $this->decorator->decorate($this->server->getGroupById($id)); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | public function patch(string $id, ?array $member = null, ?string $namespace = null, ?array $optional = null): Response |
| 310 | 310 | { |
| 311 | 311 | $attributes = compact('namespace', 'optional', 'name', 'member'); |
| 312 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 312 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 313 | 313 | |
| 314 | 314 | $group = $this->_getGroup($id, true); |
| 315 | 315 | $group->setAttributes($attributes); |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | return [ |
| 108 | - 'created' => function ($role, $requested) use ($attributes) { |
|
| 108 | + 'created' => function($role, $requested) use ($attributes) { |
|
| 109 | 109 | return $attributes['created']->toDateTime()->format('c'); |
| 110 | 110 | }, |
| 111 | - 'changed' => function ($role, $requested) use ($attributes) { |
|
| 111 | + 'changed' => function($role, $requested) use ($attributes) { |
|
| 112 | 112 | return $attributes['changed']->toDateTime()->format('c'); |
| 113 | 113 | }, |
| 114 | - 'deleted' => function ($role, $requested) use ($attributes) { |
|
| 114 | + 'deleted' => function($role, $requested) use ($attributes) { |
|
| 115 | 115 | if (false === $attributes['deleted']) { |
| 116 | 116 | return null; |
| 117 | 117 | } |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | 'name' => (string) $attributes['username'], |
| 165 | 165 | 'namespace' => (string) $attributes['namespace'], |
| 166 | 166 | 'mail' => (string) $attributes['mail'], |
| 167 | - 'avatar' => function ($role, $requested) use ($attributes) { |
|
| 167 | + 'avatar' => function($role, $requested) use ($attributes) { |
|
| 168 | 168 | if ($attributes['avatar'] instanceof Binary) { |
| 169 | 169 | return base64_encode($attributes['avatar']->getData()); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return null; |
| 173 | 173 | }, |
| 174 | - 'soft_quota' => function ($role, $requested) use ($attributes, $user) { |
|
| 174 | + 'soft_quota' => function($role, $requested) use ($attributes, $user) { |
|
| 175 | 175 | if ($user === null) { |
| 176 | 176 | return null; |
| 177 | 177 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | return null; |
| 184 | 184 | }, |
| 185 | - 'hard_quota' => function ($role, $requested) use ($attributes, $user) { |
|
| 185 | + 'hard_quota' => function($role, $requested) use ($attributes, $user) { |
|
| 186 | 186 | if ($user === null) { |
| 187 | 187 | return null; |
| 188 | 188 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'directory' => $node instanceof Collection, |
| 57 | 57 | 'meta' => $node->getMetaAttributes(), |
| 58 | 58 | 'size' => $node->getSize(), |
| 59 | - 'parent' => function ($node, $requested) use ($attributes) { |
|
| 59 | + 'parent' => function($node, $requested) use ($attributes) { |
|
| 60 | 60 | $parent = $node->getParent(); |
| 61 | 61 | |
| 62 | 62 | if (null === $parent || $parent->isRoot()) { |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | 'shared' => (string) $attributes['shared'], |
| 70 | 70 | 'created' => $attributes['created']->toDateTime()->format('c'), |
| 71 | 71 | 'changed' => $attributes['changed']->toDateTime()->format('c'), |
| 72 | - 'deleted' => function ($node, $requested) use ($attributes) { |
|
| 72 | + 'deleted' => function($node, $requested) use ($attributes) { |
|
| 73 | 73 | if (!$attributes['deleted']) { |
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $attributes['deleted']->toDateTime()->format('c'); |
| 78 | 78 | }, |
| 79 | - 'destroy' => function ($node, $requested) use ($attributes) { |
|
| 79 | + 'destroy' => function($node, $requested) use ($attributes) { |
|
| 80 | 80 | if (!$attributes['destroy']) { |
| 81 | 81 | return null; |
| 82 | 82 | } |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - $node_decorator_v2->addDecorator('sharelink_has_password', function ($node) use ($sharelink) { |
|
| 68 | + $node_decorator_v2->addDecorator('sharelink_has_password', function($node) use ($sharelink) { |
|
| 69 | 69 | $attributes = $sharelink->getSharelink($node); |
| 70 | 70 | |
| 71 | 71 | return isset($attributes['password']); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | - $node_decorator_v2->addDecorator('sharelink_token', function ($node) use ($sharelink) { |
|
| 74 | + $node_decorator_v2->addDecorator('sharelink_token', function($node) use ($sharelink) { |
|
| 75 | 75 | $attributes = $sharelink->getSharelink($node); |
| 76 | 76 | |
| 77 | 77 | if (isset($attributes['token'])) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | - $node_decorator_v2->addDecorator('sharelink_expire', function ($node) use ($sharelink) { |
|
| 82 | + $node_decorator_v2->addDecorator('sharelink_expire', function($node) use ($sharelink) { |
|
| 83 | 83 | $attributes = $sharelink->getSharelink($node); |
| 84 | 84 | |
| 85 | 85 | if (isset($attributes['expiration'])) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - $node_decorator_v1->addDecorator('sharelink', function ($node) use ($sharelink) { |
|
| 92 | + $node_decorator_v1->addDecorator('sharelink', function($node) use ($sharelink) { |
|
| 93 | 93 | return isset($sharelink->getSharelink($node)['token']); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
| 373 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 373 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 374 | 374 | |
| 375 | 375 | if (isset($attributes['avatar'])) { |
| 376 | 376 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public function patch(?string $id = null, ?string $uname = null, ?string $username = null, ?string $password = null, ?int $soft_quota = null, ?int $hard_quota = null, ?string $avatar = null, ?string $mail = null, ?bool $admin = null, ?string $namespace = null, ?string $locale = null, ?array $optional = null): Response |
| 416 | 416 | { |
| 417 | 417 | $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
| 418 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 418 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 419 | 419 | |
| 420 | 420 | if (isset($attributes['avatar'])) { |
| 421 | 421 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 186 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 187 | 187 | if (true === $move) { |
| 188 | 188 | $node = $node->setParent($parent, $conflict); |
| 189 | 189 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $node = $this->_getNode($id, $p); |
| 262 | 262 | if ($node instanceof Collection) { |
| 263 | - return (new Response())->setBody(function () use ($node) { |
|
| 263 | + return (new Response())->setBody(function() use ($node) { |
|
| 264 | 264 | $node->getZip(); |
| 265 | 265 | }); |
| 266 | 266 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $response->setOutputFormat(null) |
| 281 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 281 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 282 | 282 | $mime = $node->getContentType(); |
| 283 | 283 | $stream = $node->get(); |
| 284 | 284 | $name = $node->getName(); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 351 | 351 | { |
| 352 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 352 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 353 | 353 | $node->setReadonly($readonly); |
| 354 | 354 | |
| 355 | 355 | return ['status' => 204]; |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
| 596 | 596 | { |
| 597 | - return $this->bulk($id, $p, function ($node) { |
|
| 597 | + return $this->bulk($id, $p, function($node) { |
|
| 598 | 598 | $node->setMetaAttributes($_POST); |
| 599 | 599 | |
| 600 | 600 | return ['status' => 204]; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | ); |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 679 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 680 | 680 | $result = $node->copyTo($parent, $conflict); |
| 681 | 681 | |
| 682 | 682 | return [ |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | ); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 740 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 741 | 741 | $result = $node->setParent($parent, $conflict); |
| 742 | 742 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 743 | 743 | return [ |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 795 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 796 | 796 | if (null === $at) { |
| 797 | 797 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 798 | 798 | } else { |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return [ |
| 95 | - 'created' => function ($role) use ($attributes) { |
|
| 95 | + 'created' => function($role) use ($attributes) { |
|
| 96 | 96 | return $attributes['created']->toDateTime()->format('c'); |
| 97 | 97 | }, |
| 98 | - 'changed' => function ($role) use ($attributes) { |
|
| 98 | + 'changed' => function($role) use ($attributes) { |
|
| 99 | 99 | return $attributes['changed']->toDateTime()->format('c'); |
| 100 | 100 | }, |
| 101 | - 'deleted' => function ($role) use ($attributes) { |
|
| 101 | + 'deleted' => function($role) use ($attributes) { |
|
| 102 | 102 | if (false === $attributes['deleted']) { |
| 103 | 103 | return null; |
| 104 | 104 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'name' => (string) $attributes['username'], |
| 147 | 147 | 'admin' => (bool) $attributes['admin'], |
| 148 | 148 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
| 149 | - 'mail' => function ($role) use ($attributes, $user) { |
|
| 149 | + 'mail' => function($role) use ($attributes, $user) { |
|
| 150 | 150 | if (!isset($attributes['mail'])) { |
| 151 | 151 | return null; |
| 152 | 152 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, |
| 161 | 161 | 'hard_quota' => isset($attributes['hard_quota']) ? (int) $attributes['hard_quota'] : null, |
| 162 | 162 | 'soft_quota' => isset($attributes['soft_quota']) ? (int) $attributes['soft_quota'] : null, |
| 163 | - 'available' => function ($role) use (&$quota, $attributes, $user) { |
|
| 163 | + 'available' => function($role) use (&$quota, $attributes, $user) { |
|
| 164 | 164 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
| 165 | 165 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
| 166 | 166 | return $quota['available']; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | return null; |
| 170 | 170 | }, |
| 171 | - 'used' => function ($role) use (&$quota, $attributes, $user) { |
|
| 171 | + 'used' => function($role) use (&$quota, $attributes, $user) { |
|
| 172 | 172 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
| 173 | 173 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
| 174 | 174 | return $quota['used']; |