@@ -141,20 +141,20 @@ discard block |
||
| 141 | 141 | 'mime' => (string) $attributes['mime'], |
| 142 | 142 | 'readonly' => (bool) $attributes['readonly'], |
| 143 | 143 | 'directory' => $node instanceof Collection, |
| 144 | - 'meta' => function ($node) { |
|
| 144 | + 'meta' => function($node) { |
|
| 145 | 145 | return (object) $node->getMetaAttributes(); |
| 146 | 146 | }, |
| 147 | - 'size' => function ($node) { |
|
| 147 | + 'size' => function($node) { |
|
| 148 | 148 | return $node->getSize(); |
| 149 | 149 | }, |
| 150 | - 'path' => function ($node) { |
|
| 150 | + 'path' => function($node) { |
|
| 151 | 151 | try { |
| 152 | 152 | return $node->getPath(); |
| 153 | 153 | } catch (\Exception $e) { |
| 154 | 154 | return null; |
| 155 | 155 | } |
| 156 | 156 | }, |
| 157 | - 'parent' => function ($node) { |
|
| 157 | + 'parent' => function($node) { |
|
| 158 | 158 | $id = $node->getAttributes()['parent']; |
| 159 | 159 | |
| 160 | 160 | if (null === $id) { |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | return (string) $id; |
| 165 | 165 | }, |
| 166 | - 'access' => function ($node) use ($acl) { |
|
| 166 | + 'access' => function($node) use ($acl) { |
|
| 167 | 167 | return $acl->getAclPrivilege($node); |
| 168 | 168 | }, |
| 169 | - 'share' => function ($node) { |
|
| 169 | + 'share' => function($node) { |
|
| 170 | 170 | if ($node->isShared() || !$node->isSpecial()) { |
| 171 | 171 | return null; |
| 172 | 172 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return null; |
| 178 | 178 | } |
| 179 | 179 | }, |
| 180 | - 'shareowner' => function ($node) use ($server, $fs) { |
|
| 180 | + 'shareowner' => function($node) use ($server, $fs) { |
|
| 181 | 181 | if (!$node->isSpecial()) { |
| 182 | 182 | return null; |
| 183 | 183 | } |
@@ -223,20 +223,20 @@ discard block |
||
| 223 | 223 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
| 224 | 224 | { |
| 225 | 225 | return [ |
| 226 | - 'created' => function ($node) use ($attributes) { |
|
| 226 | + 'created' => function($node) use ($attributes) { |
|
| 227 | 227 | return $this->dateTimeToUnix($attributes['created']); |
| 228 | 228 | }, |
| 229 | - 'changed' => function ($node) use ($attributes) { |
|
| 229 | + 'changed' => function($node) use ($attributes) { |
|
| 230 | 230 | return $this->dateTimeToUnix($attributes['changed']); |
| 231 | 231 | }, |
| 232 | - 'deleted' => function ($node) use ($attributes) { |
|
| 232 | + 'deleted' => function($node) use ($attributes) { |
|
| 233 | 233 | if (false === $attributes['deleted']) { |
| 234 | 234 | return false; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return $this->dateTimeToUnix($attributes['deleted']); |
| 238 | 238 | }, |
| 239 | - 'destroy' => function ($node) use ($attributes) { |
|
| 239 | + 'destroy' => function($node) use ($attributes) { |
|
| 240 | 240 | if (null === $attributes['destroy']) { |
| 241 | 241 | return null; |
| 242 | 242 | } |
@@ -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 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 195 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 196 | 196 | if (true === $move) { |
| 197 | 197 | $node = $node->setParent($parent, $conflict); |
| 198 | 198 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $node = $this->_getNode($id, $p); |
| 275 | 275 | if ($node instanceof Collection) { |
| 276 | - return (new Response())->setBody(function () use ($node) { |
|
| 276 | + return (new Response())->setBody(function() use ($node) { |
|
| 277 | 277 | $node->getZip(); |
| 278 | 278 | }); |
| 279 | 279 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | return (new Response()) |
| 294 | 294 | ->setOutputFormat(null) |
| 295 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 295 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 296 | 296 | $mime = $node->getContentType(); |
| 297 | 297 | $stream = $node->get(); |
| 298 | 298 | $name = $node->getName(); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 367 | 367 | { |
| 368 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 368 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 369 | 369 | $node->setReadonly($readonly); |
| 370 | 370 | |
| 371 | 371 | return ['code' => 204]; |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | */ |
| 619 | 619 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
| 620 | 620 | { |
| 621 | - return $this->bulk($id, $p, function ($node) { |
|
| 621 | + return $this->bulk($id, $p, function($node) { |
|
| 622 | 622 | $node->setMetaAttributes($_POST); |
| 623 | 623 | |
| 624 | 624 | return ['code' => 204]; |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | ); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 709 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 710 | 710 | $result = $node->copyTo($parent, $conflict); |
| 711 | 711 | |
| 712 | 712 | return [ |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | ); |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 773 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 774 | 774 | $result = $node->setParent($parent, $conflict); |
| 775 | 775 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 776 | 776 | return [ |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 832 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 833 | 833 | if (null === $at) { |
| 834 | 834 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 835 | 835 | } else { |
@@ -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 { |
@@ -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 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | 'username' => (string) $attributes['username'], |
| 145 | 145 | 'name' => (string) $attributes['username'], |
| 146 | 146 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
| 147 | - 'mail' => function ($role) use ($attributes, $user) { |
|
| 147 | + 'mail' => function($role) use ($attributes, $user) { |
|
| 148 | 148 | if (!isset($attributes['mail'])) { |
| 149 | 149 | return null; |
| 150 | 150 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return null; |
| 157 | 157 | }, |
| 158 | 158 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, |
| 159 | - 'quota' => function ($role) use ($attributes, $user) { |
|
| 159 | + 'quota' => function($role) use ($attributes, $user) { |
|
| 160 | 160 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
| 161 | 161 | return $role->getQuotaUsage(); |
| 162 | 162 | } |
@@ -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 | |