@@ -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 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | return $response |
| 276 | 276 | ->setOutputFormat(null) |
| 277 | - ->setBody(function () use ($node, $offset, $limit) { |
|
| 277 | + ->setBody(function() use ($node, $offset, $limit) { |
|
| 278 | 278 | $stream = $node->get(); |
| 279 | 279 | $name = $node->getName(); |
| 280 | 280 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | return (new Response())->setCode(200)->setBody($result); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
| 413 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
| 414 | 414 | return [ |
| 415 | 415 | 'code' => 200, |
| 416 | 416 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?string $id = null, ?string $p = null): Response |
| 525 | 525 | { |
| 526 | 526 | $attributes = compact('name', 'meta', 'readonly', 'filter'); |
| 527 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 527 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 528 | 528 | |
| 529 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
| 529 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
| 530 | 530 | foreach ($attributes as $attribute => $value) { |
| 531 | 531 | switch ($attribute) { |
| 532 | 532 | case 'name': |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | ); |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 611 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 612 | 612 | $result = $node->copyTo($parent, $conflict); |
| 613 | 613 | |
| 614 | 614 | return [ |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | ); |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 675 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 676 | 676 | $result = $node->setParent($parent, $conflict); |
| 677 | 677 | |
| 678 | 678 | return [ |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 729 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 730 | 730 | if (null === $at) { |
| 731 | 731 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 732 | 732 | } else { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | protected function decorate(string $template, array $context): string |
| 221 | 221 | { |
| 222 | - return preg_replace_callback('/\{([^}\.]*)\}/', function ($match) use ($context) { |
|
| 222 | + return preg_replace_callback('/\{([^}\.]*)\}/', function($match) use ($context) { |
|
| 223 | 223 | $key = $match[1]; |
| 224 | 224 | |
| 225 | 225 | if (isset($context[$key])) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $decorator = $this->decorator; |
| 237 | 237 | |
| 238 | - return preg_replace_callback('/(\{node\.(([a-z]\.*)+)\})/', function ($match) use ($node, $decorator) { |
|
| 238 | + return preg_replace_callback('/(\{node\.(([a-z]\.*)+)\})/', function($match) use ($node, $decorator) { |
|
| 239 | 239 | $key = explode('.', $match[2]); |
| 240 | 240 | $key = array_shift($key); |
| 241 | 241 | $attrs = $decorator->decorate($node, [$key]); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | { |
| 252 | 252 | $role_decorator = $this->role_decorator; |
| 253 | 253 | |
| 254 | - return preg_replace_callback('/(\{user\.(([a-z]\.*)+)\})/', function ($match) use ($user, $role_decorator) { |
|
| 254 | + return preg_replace_callback('/(\{user\.(([a-z]\.*)+)\})/', function($match) use ($user, $role_decorator) { |
|
| 255 | 255 | $key = explode('.', $match[2]); |
| 256 | 256 | $key = array_shift($key); |
| 257 | 257 | $attrs = $role_decorator->decorate($user, [$key]); |
@@ -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 | |
@@ -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 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | 'name' => (string) $attributes['username'], |
| 146 | 146 | 'admin' => (bool) $attributes['admin'], |
| 147 | 147 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
| 148 | - 'mail' => function ($role) use ($attributes, $user) { |
|
| 148 | + 'mail' => function($role) use ($attributes, $user) { |
|
| 149 | 149 | if (!isset($attributes['mail'])) { |
| 150 | 150 | return null; |
| 151 | 151 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | return null; |
| 158 | 158 | }, |
| 159 | 159 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, |
| 160 | - 'quota' => function ($role) use ($attributes, $user) { |
|
| 160 | + 'quota' => function($role) use ($attributes, $user) { |
|
| 161 | 161 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
| 162 | 162 | return $role->getQuotaUsage(); |
| 163 | 163 | } |
@@ -127,20 +127,20 @@ discard block |
||
| 127 | 127 | 'mime' => (string) $attributes['mime'], |
| 128 | 128 | 'readonly' => (bool) $attributes['readonly'], |
| 129 | 129 | 'directory' => $node instanceof Collection, |
| 130 | - 'meta' => function ($node) { |
|
| 130 | + 'meta' => function($node) { |
|
| 131 | 131 | return (object) $node->getMetaAttributes(); |
| 132 | 132 | }, |
| 133 | - 'size' => function ($node) { |
|
| 133 | + 'size' => function($node) { |
|
| 134 | 134 | return $node->getSize(); |
| 135 | 135 | }, |
| 136 | - 'path' => function ($node) { |
|
| 136 | + 'path' => function($node) { |
|
| 137 | 137 | try { |
| 138 | 138 | return $node->getPath(); |
| 139 | 139 | } catch (\Exception $e) { |
| 140 | 140 | return null; |
| 141 | 141 | } |
| 142 | 142 | }, |
| 143 | - 'parent' => function ($node) { |
|
| 143 | + 'parent' => function($node) { |
|
| 144 | 144 | $id = $node->getAttributes()['parent']; |
| 145 | 145 | |
| 146 | 146 | if (null === $id) { |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | return (string) $id; |
| 151 | 151 | }, |
| 152 | - 'access' => function ($node) use ($acl) { |
|
| 152 | + 'access' => function($node) use ($acl) { |
|
| 153 | 153 | return $acl->getAclPrivilege($node); |
| 154 | 154 | }, |
| 155 | - 'share' => function ($node) { |
|
| 155 | + 'share' => function($node) { |
|
| 156 | 156 | if (!$node->isShared() && !$node->isSpecial()) { |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return false; |
| 164 | 164 | } |
| 165 | 165 | }, |
| 166 | - 'shareowner' => function ($node) use ($server, $fs) { |
|
| 166 | + 'shareowner' => function($node) use ($server, $fs) { |
|
| 167 | 167 | if (!$node->isSpecial()) { |
| 168 | 168 | return null; |
| 169 | 169 | } |
@@ -206,20 +206,20 @@ discard block |
||
| 206 | 206 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
| 207 | 207 | { |
| 208 | 208 | return [ |
| 209 | - 'created' => function ($node) use ($attributes) { |
|
| 209 | + 'created' => function($node) use ($attributes) { |
|
| 210 | 210 | return $this->dateTimeToUnix($attributes['created']); |
| 211 | 211 | }, |
| 212 | - 'changed' => function ($node) use ($attributes) { |
|
| 212 | + 'changed' => function($node) use ($attributes) { |
|
| 213 | 213 | return $this->dateTimeToUnix($attributes['changed']); |
| 214 | 214 | }, |
| 215 | - 'deleted' => function ($node) use ($attributes) { |
|
| 215 | + 'deleted' => function($node) use ($attributes) { |
|
| 216 | 216 | if (false === $attributes['deleted']) { |
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $this->dateTimeToUnix($attributes['deleted']); |
| 221 | 221 | }, |
| 222 | - 'destroy' => function ($node) use ($attributes) { |
|
| 222 | + 'destroy' => function($node) use ($attributes) { |
|
| 223 | 223 | if (null === $attributes['destroy']) { |
| 224 | 224 | return null; |
| 225 | 225 | } |
@@ -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 { |