@@ -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 | } |
@@ -173,7 +173,7 @@ |
||
173 | 173 | $tpl = new Template($type); |
174 | 174 | |
175 | 175 | $attributes = compact('readonly', 'meta'); |
176 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
176 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
177 | 177 | |
178 | 178 | $result = $parent->addFile($name, $tpl->get(), $attributes); |
179 | 179 | $result = $this->decorator->decorate($result); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | try { |
344 | 344 | $attributes = compact('changed', 'created', 'readonly', 'meta'); |
345 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
345 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
346 | 346 | $attributes = $this->_verifyAttributes($attributes); |
347 | 347 | |
348 | 348 | return $this->_put($file, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $content = fopen('php://input', 'rb'); |
464 | 464 | |
465 | 465 | $attributes = compact('changed', 'created', 'readonly', 'meta'); |
466 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
466 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
467 | 467 | $attributes = $this->_verifyAttributes($attributes); |
468 | 468 | |
469 | 469 | return $this->_put($content, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -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); |
@@ -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 { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
391 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
391 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
392 | 392 | |
393 | 393 | if (isset($attributes['avatar'])) { |
394 | 394 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 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 = false, ?string $namespace = null, ?string $locale = null, ?array $optional = null): Response |
437 | 437 | { |
438 | 438 | $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
439 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
439 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
440 | 440 | |
441 | 441 | if (isset($attributes['avatar'])) { |
442 | 442 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -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 { |