@@ -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 | - 'lock' => function ($node) use ($server, $decorator, $attributes) { |
|
148 | + 'lock' => function($node) use ($server, $decorator, $attributes) { |
|
149 | 149 | if (!$node->isLocked()) { |
150 | 150 | return null; |
151 | 151 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'id' => $lock['id'], |
171 | 171 | ]; |
172 | 172 | }, |
173 | - 'share' => function ($node) use ($fs) { |
|
173 | + 'share' => function($node) use ($fs) { |
|
174 | 174 | if ($node->isShared() || !$node->isSpecial()) { |
175 | 175 | return null; |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | }, |
184 | - 'sharename' => function ($node) { |
|
184 | + 'sharename' => function($node) { |
|
185 | 185 | if (!$node->isShared()) { |
186 | 186 | return null; |
187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return null; |
193 | 193 | } |
194 | 194 | }, |
195 | - 'shareowner' => function ($node) use ($server, $fs, $decorator) { |
|
195 | + 'shareowner' => function($node) use ($server, $fs, $decorator) { |
|
196 | 196 | if (!$node->isSpecial()) { |
197 | 197 | return null; |
198 | 198 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return null; |
207 | 207 | } |
208 | 208 | }, |
209 | - 'owner' => function ($node) use ($server, $decorator) { |
|
209 | + 'owner' => function($node) use ($server, $decorator) { |
|
210 | 210 | try { |
211 | 211 | return $decorator->decorate( |
212 | 212 | $server->getUserById($node->getOwner()), |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
228 | 228 | { |
229 | 229 | return [ |
230 | - 'created' => function ($node) use ($attributes) { |
|
230 | + 'created' => function($node) use ($attributes) { |
|
231 | 231 | return $attributes['created']->toDateTime()->format('c'); |
232 | 232 | }, |
233 | - 'changed' => function ($node) use ($attributes) { |
|
233 | + 'changed' => function($node) use ($attributes) { |
|
234 | 234 | return $attributes['changed']->toDateTime()->format('c'); |
235 | 235 | }, |
236 | - 'deleted' => function ($node) use ($attributes) { |
|
236 | + 'deleted' => function($node) use ($attributes) { |
|
237 | 237 | if (false === $attributes['deleted']) { |
238 | 238 | return null; |
239 | 239 | } |
240 | 240 | |
241 | 241 | return $attributes['deleted']->toDateTime()->format('c'); |
242 | 242 | }, |
243 | - 'destroy' => function ($node) use ($attributes) { |
|
243 | + 'destroy' => function($node) use ($attributes) { |
|
244 | 244 | if (null === $attributes['destroy']) { |
245 | 245 | return null; |
246 | 246 | } |
@@ -268,14 +268,14 @@ discard block |
||
268 | 268 | return [ |
269 | 269 | 'shared' => $node->isShared(), |
270 | 270 | 'reference' => $node->isReference(), |
271 | - 'filter' => function ($node) use ($attributes) { |
|
271 | + 'filter' => function($node) use ($attributes) { |
|
272 | 272 | if (null === $attributes['filter']) { |
273 | 273 | return null; |
274 | 274 | } |
275 | 275 | |
276 | 276 | return json_decode($attributes['filter'], true, 512, JSON_THROW_ON_ERROR); |
277 | 277 | }, |
278 | - 'mount' => function ($node) use ($fs, $attributes) { |
|
278 | + 'mount' => function($node) use ($fs, $attributes) { |
|
279 | 279 | $mount = $node->getAttributes()['mount']; |
280 | 280 | |
281 | 281 | if (!$node->isMounted() && !$node->isReference()) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if ( |
83 | 83 | !($this->auth->getIdentity()->getAdapter() instanceof AuthNone)) { |
84 | - $this->auth->getIdentity()->getAttributeMap()->addMapper('binary', function ($value) { |
|
84 | + $this->auth->getIdentity()->getAttributeMap()->addMapper('binary', function($value) { |
|
85 | 85 | return new Binary($value, Binary::TYPE_GENERIC); |
86 | 86 | }); |
87 | 87 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function setExceptionHandler(): self |
140 | 140 | { |
141 | - set_exception_handler(function ($e) { |
|
141 | + set_exception_handler(function($e) { |
|
142 | 142 | $this->logger->emergency('uncaught exception: '.$e->getMessage(), [ |
143 | 143 | 'category' => get_class($this), |
144 | 144 | 'exception' => $e, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - return $this->bulk($id, function ($node) use ($parent, $conflict, $move) { |
|
102 | + return $this->bulk($id, function($node) use ($parent, $conflict, $move) { |
|
103 | 103 | if (true === $move) { |
104 | 104 | $node = $node->setParent($parent, $conflict); |
105 | 105 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | return (new Response())->setCode(200)->setBody($result); |
167 | 167 | } |
168 | 168 | |
169 | - return $this->bulk($id, function ($node) use ($attributes) { |
|
169 | + return $this->bulk($id, function($node) use ($attributes) { |
|
170 | 170 | return [ |
171 | 171 | 'code' => 200, |
172 | 172 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | public function patch(string $id, ?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null, $lock = null): Response |
203 | 203 | { |
204 | 204 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl', 'lock'); |
205 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
205 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
206 | 206 | |
207 | 207 | $lock = $_SERVER['HTTP_LOCK_TOKEN'] ?? null; |
208 | 208 | |
209 | - return $this->bulk($id, function ($node) use ($attributes, $lock) { |
|
209 | + return $this->bulk($id, function($node) use ($attributes, $lock) { |
|
210 | 210 | foreach ($attributes as $attribute => $value) { |
211 | 211 | switch ($attribute) { |
212 | 212 | case 'name': |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
264 | 264 | } |
265 | 265 | |
266 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
266 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
267 | 267 | $result = $node->copyTo($parent, $conflict); |
268 | 268 | |
269 | 269 | return [ |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
288 | 288 | } |
289 | 289 | |
290 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
290 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
291 | 291 | $result = $node->setParent($parent, $conflict); |
292 | 292 | |
293 | 293 | return [ |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
313 | 313 | } |
314 | 314 | |
315 | - return $this->bulk($id, function ($node) use ($force, $ignore_flag, $at) { |
|
315 | + return $this->bulk($id, function($node) use ($force, $ignore_flag, $at) { |
|
316 | 316 | if (null === $at) { |
317 | 317 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
318 | 318 | } else { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
191 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
192 | 192 | if (true === $move) { |
193 | 193 | $node = $node->setParent($parent, $conflict); |
194 | 194 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | $node = $this->_getNode($id, $p); |
267 | 267 | if ($node instanceof Collection) { |
268 | - return (new Response())->setBody(function () use ($node) { |
|
268 | + return (new Response())->setBody(function() use ($node) { |
|
269 | 269 | $node->getZip(); |
270 | 270 | }); |
271 | 271 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | return $response->setOutputFormat(null) |
287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
287 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
288 | 288 | $mime = $node->getContentType(); |
289 | 289 | $stream = $node->get(); |
290 | 290 | $name = $node->getName(); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
354 | 354 | { |
355 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
355 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
356 | 356 | $node->setReadonly($readonly); |
357 | 357 | |
358 | 358 | return ['status' => 204]; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
599 | 599 | { |
600 | - return $this->bulk($id, $p, function ($node) { |
|
600 | + return $this->bulk($id, $p, function($node) { |
|
601 | 601 | $node->setMetaAttributes($_POST); |
602 | 602 | |
603 | 603 | return ['status' => 204]; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
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 [ |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
735 | 735 | } |
736 | 736 | |
737 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
737 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
738 | 738 | $result = $node->setParent($parent, $conflict); |
739 | 739 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
740 | 740 | return [ |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
790 | 790 | } |
791 | 791 | |
792 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
792 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
793 | 793 | if (null === $at) { |
794 | 794 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
795 | 795 | } else { |