@@ -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]); |
@@ -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 | $stream = $tpl->get(); |
167 | 167 | $storage = $parent->getStorage(); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | if ($index === $chunks) { |
286 | 286 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
287 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
287 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
288 | 288 | $attributes = $this->_verifyAttributes($attributes); |
289 | 289 | |
290 | 290 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $storage = $this->getStorage($id, $p, $collection); |
400 | 400 | $session = $storage->storeTemporaryFile($input, $this->server->getIdentity()); |
401 | 401 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
402 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
402 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
403 | 403 | $attributes = $this->_verifyAttributes($attributes); |
404 | 404 | |
405 | 405 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -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) { |
@@ -144,7 +144,7 @@ |
||
144 | 144 | protected function deleteNode(NodeInterface $node, Blackhole $dummy): bool |
145 | 145 | { |
146 | 146 | if ($node instanceof Collection) { |
147 | - $node->doRecursiveAction(function (NodeInterface $node) use ($dummy) { |
|
147 | + $node->doRecursiveAction(function(NodeInterface $node) use ($dummy) { |
|
148 | 148 | if ($node instanceof Collection) { |
149 | 149 | $node->setStorage($dummy); |
150 | 150 | } |
@@ -113,20 +113,20 @@ discard block |
||
113 | 113 | 'mime' => (string) $attributes['mime'], |
114 | 114 | 'readonly' => (bool) $attributes['readonly'], |
115 | 115 | 'directory' => $node instanceof Collection, |
116 | - 'meta' => function ($node) { |
|
116 | + 'meta' => function($node) { |
|
117 | 117 | return (object) $node->getMetaAttributes(); |
118 | 118 | }, |
119 | - 'size' => function ($node) { |
|
119 | + 'size' => function($node) { |
|
120 | 120 | return $node->getSize(); |
121 | 121 | }, |
122 | - 'path' => function ($node) { |
|
122 | + 'path' => function($node) { |
|
123 | 123 | try { |
124 | 124 | return $node->getPath(); |
125 | 125 | } catch (\Exception $e) { |
126 | 126 | return null; |
127 | 127 | } |
128 | 128 | }, |
129 | - 'parent' => function ($node) { |
|
129 | + 'parent' => function($node) { |
|
130 | 130 | $parent = $node->getParent(); |
131 | 131 | |
132 | 132 | if (null === $parent || $parent->isRoot()) { |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | |
136 | 136 | return $this->decorate($node->getParent(), ['id', 'name', '_links']); |
137 | 137 | }, |
138 | - 'access' => function ($node) use ($acl) { |
|
138 | + 'access' => function($node) use ($acl) { |
|
139 | 139 | return $acl->getAclPrivilege($node); |
140 | 140 | }, |
141 | - 'acl' => function ($node) use ($attributes) { |
|
141 | + 'acl' => function($node) use ($attributes) { |
|
142 | 142 | if ($node->isShareMember() && count($attributes['acl']) > 0) { |
143 | 143 | return $node->getAcl(); |
144 | 144 | } |
145 | 145 | |
146 | 146 | return null; |
147 | 147 | }, |
148 | - 'share' => function ($node) use ($fs) { |
|
148 | + 'share' => function($node) use ($fs) { |
|
149 | 149 | if ($node->isShared() || !$node->isSpecial()) { |
150 | 150 | return null; |
151 | 151 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | return null; |
157 | 157 | } |
158 | 158 | }, |
159 | - 'sharename' => function ($node) { |
|
159 | + 'sharename' => function($node) { |
|
160 | 160 | if (!$node->isShared()) { |
161 | 161 | return null; |
162 | 162 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return null; |
168 | 168 | } |
169 | 169 | }, |
170 | - 'shareowner' => function ($node) use ($server, $fs, $decorator) { |
|
170 | + 'shareowner' => function($node) use ($server, $fs, $decorator) { |
|
171 | 171 | if (!$node->isSpecial()) { |
172 | 172 | return null; |
173 | 173 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | }, |
184 | - 'owner' => function ($node) use ($server, $decorator) { |
|
184 | + 'owner' => function($node) use ($server, $decorator) { |
|
185 | 185 | try { |
186 | 186 | return $decorator->decorate( |
187 | 187 | $server->getUserById($node->getOwner()), |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return null; |
192 | 192 | } |
193 | 193 | }, |
194 | - 'external_storage' => function ($node) use ($fs, $attributes) { |
|
194 | + 'external_storage' => function($node) use ($fs, $attributes) { |
|
195 | 195 | if ($node->getMount() === null || $node instanceof Collection && $node->isMounted()) { |
196 | 196 | return null; |
197 | 197 | } |
@@ -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 | } |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | return [ |
251 | 251 | 'shared' => $node->isShared(), |
252 | 252 | 'reference' => $node->isReference(), |
253 | - 'filter' => function ($node) use ($attributes) { |
|
253 | + 'filter' => function($node) use ($attributes) { |
|
254 | 254 | if (null === $attributes['filter']) { |
255 | 255 | return null; |
256 | 256 | } |
257 | 257 | |
258 | 258 | return json_decode($attributes['filter'], true); |
259 | 259 | }, |
260 | - 'mount' => function ($node) use ($fs, $attributes) { |
|
260 | + 'mount' => function($node) use ($fs, $attributes) { |
|
261 | 261 | $mount = $node->getAttributes()['mount']; |
262 | 262 | |
263 | 263 | if (!$node->isMounted() && !$node->isReference()) { |