@@ -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 { |
@@ -161,7 +161,7 @@ |
||
161 | 161 | $tpl = new Template($type); |
162 | 162 | |
163 | 163 | $attributes = compact('readonly', 'meta'); |
164 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
164 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
165 | 165 | |
166 | 166 | $session = $parent->temporarySession($tpl->get()); |
167 | 167 | $result = $parent->addFile($name, $session, $attributes); |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | 'mime' => (string) $attributes['mime'], |
121 | 121 | 'readonly' => (bool) $attributes['readonly'], |
122 | 122 | 'directory' => $node instanceof Collection, |
123 | - 'meta' => function ($node) { |
|
123 | + 'meta' => function($node) { |
|
124 | 124 | return (object) $node->getMetaAttributes(); |
125 | 125 | }, |
126 | - 'size' => function ($node) { |
|
126 | + 'size' => function($node) { |
|
127 | 127 | return $node->getSize(); |
128 | 128 | }, |
129 | - 'path' => function ($node) { |
|
129 | + 'path' => function($node) { |
|
130 | 130 | try { |
131 | 131 | return $node->getPath(); |
132 | 132 | } catch (\Exception $e) { |
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | }, |
136 | - 'parent' => function ($node) { |
|
136 | + 'parent' => function($node) { |
|
137 | 137 | $parent = $node->getParent(); |
138 | 138 | |
139 | 139 | if (null === $parent || $parent->isRoot()) { |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | |
143 | 143 | return $this->decorate($node->getParent(), ['id', 'name', '_links']); |
144 | 144 | }, |
145 | - 'access' => function ($node) use ($acl) { |
|
145 | + 'access' => function($node) use ($acl) { |
|
146 | 146 | return $acl->getAclPrivilege($node); |
147 | 147 | }, |
148 | - 'acl' => function ($node) use ($attributes) { |
|
148 | + 'acl' => function($node) use ($attributes) { |
|
149 | 149 | if ($node->isShareMember() && count($attributes['acl']) > 0) { |
150 | 150 | return $node->getAcl(); |
151 | 151 | } |
152 | 152 | |
153 | 153 | return null; |
154 | 154 | }, |
155 | - 'share' => function ($node) { |
|
155 | + 'share' => function($node) { |
|
156 | 156 | if ($node->isShared() || !$node->isSpecial()) { |
157 | 157 | return null; |
158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | }, |
166 | - 'sharename' => function ($node) { |
|
166 | + 'sharename' => function($node) { |
|
167 | 167 | if (!$node->isShared()) { |
168 | 168 | return null; |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | }, |
177 | - 'shareowner' => function ($node) use ($server, $fs, $decorator) { |
|
177 | + 'shareowner' => function($node) use ($server, $fs, $decorator) { |
|
178 | 178 | if (!$node->isSpecial()) { |
179 | 179 | return null; |
180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return null; |
189 | 189 | } |
190 | 190 | }, |
191 | - 'owner' => function ($node) use ($server, $decorator) { |
|
191 | + 'owner' => function($node) use ($server, $decorator) { |
|
192 | 192 | try { |
193 | 193 | return $decorator->decorate( |
194 | 194 | $server->getUserById($node->getOwner()), |
@@ -209,20 +209,20 @@ discard block |
||
209 | 209 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
210 | 210 | { |
211 | 211 | return [ |
212 | - 'created' => function ($node) use ($attributes) { |
|
212 | + 'created' => function($node) use ($attributes) { |
|
213 | 213 | return $attributes['created']->toDateTime()->format('c'); |
214 | 214 | }, |
215 | - 'changed' => function ($node) use ($attributes) { |
|
215 | + 'changed' => function($node) use ($attributes) { |
|
216 | 216 | return $attributes['changed']->toDateTime()->format('c'); |
217 | 217 | }, |
218 | - 'deleted' => function ($node) use ($attributes) { |
|
218 | + 'deleted' => function($node) use ($attributes) { |
|
219 | 219 | if (false === $attributes['deleted']) { |
220 | 220 | return null; |
221 | 221 | } |
222 | 222 | |
223 | 223 | return $attributes['deleted']->toDateTime()->format('c'); |
224 | 224 | }, |
225 | - 'destroy' => function ($node) use ($attributes) { |
|
225 | + 'destroy' => function($node) use ($attributes) { |
|
226 | 226 | if (null === $attributes['destroy']) { |
227 | 227 | return null; |
228 | 228 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return [ |
253 | 253 | 'shared' => $node->isShared(), |
254 | 254 | 'reference' => $node->isReference(), |
255 | - 'filter' => function ($node) use ($attributes) { |
|
255 | + 'filter' => function($node) use ($attributes) { |
|
256 | 256 | if (null === $attributes['filter']) { |
257 | 257 | return null; |
258 | 258 | } |
@@ -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']; |
@@ -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 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | return $response |
272 | 272 | ->setOutputFormat(null) |
273 | - ->setBody(function () use ($node, $offset, $limit) { |
|
273 | + ->setBody(function() use ($node, $offset, $limit) { |
|
274 | 274 | $stream = $node->get(); |
275 | 275 | $name = $node->getName(); |
276 | 276 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | return (new Response())->setCode(200)->setBody($result); |
402 | 402 | } |
403 | 403 | |
404 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
404 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
405 | 405 | return [ |
406 | 406 | 'code' => 200, |
407 | 407 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null, ?string $id = null, ?string $p = null): Response |
510 | 510 | { |
511 | 511 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl'); |
512 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
512 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
513 | 513 | |
514 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
514 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
515 | 515 | foreach ($attributes as $attribute => $value) { |
516 | 516 | switch ($attribute) { |
517 | 517 | case 'name': |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | ); |
595 | 595 | } |
596 | 596 | |
597 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
597 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
598 | 598 | $result = $node->copyTo($parent, $conflict); |
599 | 599 | |
600 | 600 | return [ |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | ); |
656 | 656 | } |
657 | 657 | |
658 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
658 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
659 | 659 | $result = $node->setParent($parent, $conflict); |
660 | 660 | |
661 | 661 | return [ |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
706 | 706 | } |
707 | 707 | |
708 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
708 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
709 | 709 | if (null === $at) { |
710 | 710 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
711 | 711 | } else { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | if ($index === $chunks) { |
283 | 283 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
284 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
284 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
285 | 285 | $attributes = $this->_verifyAttributes($attributes); |
286 | 286 | |
287 | 287 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $session = $this->storage->storeTemporaryFile($input, $this->server->getIdentity()); |
396 | 396 | |
397 | 397 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
398 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
398 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
399 | 399 | $attributes = $this->_verifyAttributes($attributes); |
400 | 400 | |
401 | 401 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | if ($node instanceof Collection && $recursive === true) { |
350 | 350 | $db = $this->db; |
351 | - $node->doRecursiveAction(function ($child) use ($db, $subscription) { |
|
351 | + $node->doRecursiveAction(function($child) use ($db, $subscription) { |
|
352 | 352 | $subscription['node'] = $child->getId(); |
353 | 353 | $db->subscription->replaceOne( |
354 | 354 | [ |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | if ($node instanceof Collection && $recursive === true) { |
376 | 376 | $db = $this->db; |
377 | - $node->doRecursiveAction(function ($child) use ($db, $node_id, $user_id) { |
|
377 | + $node->doRecursiveAction(function($child) use ($db, $node_id, $user_id) { |
|
378 | 378 | $db->subscription->deleteOne([ |
379 | 379 | 'user' => $user_id, |
380 | 380 | 'node' => $node_id, |
@@ -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 | $parent = $node->getParent(); |
145 | 145 | |
146 | 146 | if (null === $parent || $parent->isRoot()) { |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | |
150 | 150 | return (string) $parent->getId(); |
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 | } |