@@ -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 |
@@ -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 { |
@@ -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 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'message' => (string) $message['body'], |
99 | 99 | 'subject' => (string) $message['subject'], |
100 | 100 | 'locale' => (string) $message['locale'], |
101 | - 'sender' => function ($message) use ($server, $role_decorator) { |
|
101 | + 'sender' => function($message) use ($server, $role_decorator) { |
|
102 | 102 | if (!isset($message['sender'])) { |
103 | 103 | return null; |
104 | 104 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | return null; |
110 | 110 | } |
111 | 111 | }, |
112 | - 'created' => function ($message) { |
|
112 | + 'created' => function($message) { |
|
113 | 113 | return (new DateTime())->setTimestamp($message['_id']->getTimestamp())->format('c'); |
114 | 114 | }, |
115 | - 'node' => function ($message) use ($node_decorator, $fs) { |
|
115 | + 'node' => function($message) use ($node_decorator, $fs) { |
|
116 | 116 | if (isset($message['node'])) { |
117 | 117 | try { |
118 | 118 | return $node_decorator->decorate($fs->findNodeById($message['node']), ['id', 'name', '_links']); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | protected function decorate(string $template, array $context): string |
220 | 220 | { |
221 | - return preg_replace_callback('/\{([^}\.]*)\}/', function ($match) use ($context) { |
|
221 | + return preg_replace_callback('/\{([^}\.]*)\}/', function($match) use ($context) { |
|
222 | 222 | $key = $match[1]; |
223 | 223 | |
224 | 224 | if (isset($context[$key])) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | protected function decorateResource(string $template, $resource, string $prefix, $decorator): string |
234 | 234 | { |
235 | - return preg_replace_callback('/(\{'.$prefix.'\.(([a-z]\.*)+)\})/', function ($match) use ($resource, $decorator) { |
|
235 | + return preg_replace_callback('/(\{'.$prefix.'\.(([a-z]\.*)+)\})/', function($match) use ($resource, $decorator) { |
|
236 | 236 | $key = explode('.', $match[2]); |
237 | 237 | $key = array_shift($key); |
238 | 238 | $attrs = $decorator->decorate($resource, [$key]); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | protected function setErrorHandler(LoggerInterface $logger): self |
56 | 56 | { |
57 | - set_error_handler(function ($severity, $message, $file, $line) use ($logger) { |
|
57 | + set_error_handler(function($severity, $message, $file, $line) use ($logger) { |
|
58 | 58 | $log = $message.' in '.$file.':'.$line; |
59 | 59 | |
60 | 60 | switch ($severity) { |