@@ -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()), |
@@ -202,20 +202,20 @@ discard block |
||
202 | 202 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
203 | 203 | { |
204 | 204 | return [ |
205 | - 'created' => function ($node) use ($attributes) { |
|
205 | + 'created' => function($node) use ($attributes) { |
|
206 | 206 | return $attributes['created']->toDateTime()->format('c'); |
207 | 207 | }, |
208 | - 'changed' => function ($node) use ($attributes) { |
|
208 | + 'changed' => function($node) use ($attributes) { |
|
209 | 209 | return $attributes['changed']->toDateTime()->format('c'); |
210 | 210 | }, |
211 | - 'deleted' => function ($node) use ($attributes) { |
|
211 | + 'deleted' => function($node) use ($attributes) { |
|
212 | 212 | if (false === $attributes['deleted']) { |
213 | 213 | return null; |
214 | 214 | } |
215 | 215 | |
216 | 216 | return $attributes['deleted']->toDateTime()->format('c'); |
217 | 217 | }, |
218 | - 'destroy' => function ($node) use ($attributes) { |
|
218 | + 'destroy' => function($node) use ($attributes) { |
|
219 | 219 | if (null === $attributes['destroy']) { |
220 | 220 | return null; |
221 | 221 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | return [ |
244 | 244 | 'shared' => $node->isShared(), |
245 | 245 | 'reference' => $node->isReference(), |
246 | - 'filter' => function ($node) use ($attributes) { |
|
246 | + 'filter' => function($node) use ($attributes) { |
|
247 | 247 | if (null === $attributes['filter']) { |
248 | 248 | return null; |
249 | 249 | } |
250 | 250 | |
251 | 251 | return json_decode($attributes['filter'], true); |
252 | 252 | }, |
253 | - 'mount' => function ($node) use ($fs, $attributes) { |
|
253 | + 'mount' => function($node) use ($fs, $attributes) { |
|
254 | 254 | $mount = $node->getAttributes()['mount']; |
255 | 255 | |
256 | 256 | if (!$node->isMounted() && !$node->isReference()) { |
@@ -246,7 +246,7 @@ |
||
246 | 246 | $delta[$share_member->getPath()] = $share_member; |
247 | 247 | } |
248 | 248 | } elseif ('undeleteCollection' === $log['operation'] || 'undeleteCollectionShare' === $log['operation']) { |
249 | - $log_node->doRecursiveAction(function ($sub_node) use (&$delta) { |
|
249 | + $log_node->doRecursiveAction(function($sub_node) use (&$delta) { |
|
250 | 250 | $delta[$sub_node->getPath()] = $sub_node; |
251 | 251 | }); |
252 | 252 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | return $response |
37 | 37 | ->setOutputFormat(null) |
38 | - ->setBody(function () use ($file) { |
|
38 | + ->setBody(function() use ($file) { |
|
39 | 39 | $stream = $file->get(); |
40 | 40 | $name = $file->getName(); |
41 | 41 |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $this->storage = $this->_parent->getStorage()->deleteCollection($this); |
363 | 363 | |
364 | 364 | if (!$this->isReference() && !$this->isMounted() && !$this->isFiltered()) { |
365 | - $this->doRecursiveAction(function ($node) use ($recursion) { |
|
365 | + $this->doRecursiveAction(function($node) use ($recursion) { |
|
366 | 366 | $node->delete(false, $recursion, false); |
367 | 367 | }, NodeInterface::DELETED_EXCLUDE); |
368 | 368 | } |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | protected function _forceDelete(?string $recursion = null, bool $recursion_first = true): bool |
918 | 918 | { |
919 | 919 | if (!$this->isReference() && !$this->isMounted() && !$this->isFiltered()) { |
920 | - $this->doRecursiveAction(function ($node) use ($recursion) { |
|
920 | + $this->doRecursiveAction(function($node) use ($recursion) { |
|
921 | 921 | $node->delete(true, $recursion, false); |
922 | 922 | }, NodeInterface::DELETED_INCLUDE); |
923 | 923 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if ($index === $chunks) { |
98 | 98 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
99 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
99 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
100 | 100 | $attributes = $this->_verifyAttributes($attributes); |
101 | 101 | |
102 | 102 | return $this->_put($session, $id, $collection, $name, $attributes, $conflict); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $storage = $this->getStorage($id, $collection); |
129 | 129 | $session = $storage->storeTemporaryFile($input, $this->server->getIdentity()); |
130 | 130 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
131 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
131 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
132 | 132 | $attributes = $this->_verifyAttributes($attributes); |
133 | 133 | |
134 | 134 | return $this->_put($session, $id, $collection, $name, $attributes, $conflict); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale'); |
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 | if (isset($attributes['avatar'])) { |
167 | 167 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | public function patch(string $id, ?string $username = null, ?string $password = null, ?int $soft_quota = null, ?int $hard_quota = null, ?string $avatar = null, ?string $mail = null, ?bool $admin = null, ?string $namespace = null, ?string $locale = null, ?bool $multi_factor_auth = null): Response |
180 | 180 | { |
181 | 181 | $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'multi_factor_auth'); |
182 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
182 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
183 | 183 | |
184 | 184 | if (isset($attributes['avatar'])) { |
185 | 185 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - return $this->bulk($id, function ($node) use ($parent, $conflict, $move) { |
|
105 | + return $this->bulk($id, function($node) use ($parent, $conflict, $move) { |
|
106 | 106 | if (true === $move) { |
107 | 107 | $node = $node->setParent($parent, $conflict); |
108 | 108 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | return (new Response())->setCode(200)->setBody($result); |
177 | 177 | } |
178 | 178 | |
179 | - return $this->bulk($id, function ($node) use ($attributes) { |
|
179 | + return $this->bulk($id, function($node) use ($attributes) { |
|
180 | 180 | return [ |
181 | 181 | 'code' => 200, |
182 | 182 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | public function patch(string $id, ?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null): Response |
211 | 211 | { |
212 | 212 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl'); |
213 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
213 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
214 | 214 | |
215 | - return $this->bulk($id, function ($node) use ($attributes) { |
|
215 | + return $this->bulk($id, function($node) use ($attributes) { |
|
216 | 216 | foreach ($attributes as $attribute => $value) { |
217 | 217 | switch ($attribute) { |
218 | 218 | case 'name': |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ); |
265 | 265 | } |
266 | 266 | |
267 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
267 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
268 | 268 | $result = $node->copyTo($parent, $conflict); |
269 | 269 | |
270 | 270 | return [ |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ); |
292 | 292 | } |
293 | 293 | |
294 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
294 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
295 | 295 | $result = $node->setParent($parent, $conflict); |
296 | 296 | |
297 | 297 | return [ |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
317 | 317 | } |
318 | 318 | |
319 | - return $this->bulk($id, function ($node) use ($force, $ignore_flag, $at) { |
|
319 | + return $this->bulk($id, function($node) use ($force, $ignore_flag, $at) { |
|
320 | 320 | if (null === $at) { |
321 | 321 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
322 | 322 | } else { |