@@ -85,7 +85,7 @@ |
||
85 | 85 | /** |
86 | 86 | * Add decorator. |
87 | 87 | * |
88 | - * @return AttributeDecorator |
|
88 | + * @return NodeDecorator |
|
89 | 89 | */ |
90 | 90 | public function addDecorator(string $attribute, Closure $decorator): self |
91 | 91 | { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | /** |
73 | 73 | * Add decorator. |
74 | 74 | * |
75 | - * @return AttributeDecorator |
|
75 | + * @return RoleDecorator |
|
76 | 76 | */ |
77 | 77 | public function addDecorator(string $attribute, Closure $decorator): self |
78 | 78 | { |
@@ -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 { |
@@ -284,46 +284,46 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | return $response->setOutputFormat(null) |
287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
288 | - $mime = $node->getContentType(); |
|
289 | - $stream = $node->get(); |
|
290 | - $name = $node->getName(); |
|
291 | - |
|
292 | - if (null === $stream) { |
|
293 | - return; |
|
294 | - } |
|
295 | - |
|
296 | - if (0 !== $offset) { |
|
297 | - if (fseek($stream, $offset) === -1) { |
|
298 | - throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
299 | - } |
|
300 | - } |
|
301 | - |
|
302 | - $read = 0; |
|
303 | - header('Content-Type: '.$mime.''); |
|
304 | - if ('base64' === $encode) { |
|
305 | - header('Content-Encoding: base64'); |
|
306 | - while (!feof($stream)) { |
|
307 | - if (0 !== $length && $read + 8192 > $length) { |
|
308 | - echo base64_encode(fread($stream, $length - $read)); |
|
309 | - exit(); |
|
310 | - } |
|
311 | - |
|
312 | - echo base64_encode(fread($stream, 8192)); |
|
313 | - $read += 8192; |
|
314 | - } |
|
315 | - } else { |
|
316 | - while (!feof($stream)) { |
|
317 | - if (0 !== $length && $read + 8192 > $length) { |
|
318 | - echo fread($stream, $length - $read); |
|
319 | - exit(); |
|
320 | - } |
|
321 | - |
|
322 | - echo fread($stream, 8192); |
|
323 | - $read += 8192; |
|
324 | - } |
|
325 | - } |
|
326 | - }); |
|
287 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
288 | + $mime = $node->getContentType(); |
|
289 | + $stream = $node->get(); |
|
290 | + $name = $node->getName(); |
|
291 | + |
|
292 | + if (null === $stream) { |
|
293 | + return; |
|
294 | + } |
|
295 | + |
|
296 | + if (0 !== $offset) { |
|
297 | + if (fseek($stream, $offset) === -1) { |
|
298 | + throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
299 | + } |
|
300 | + } |
|
301 | + |
|
302 | + $read = 0; |
|
303 | + header('Content-Type: '.$mime.''); |
|
304 | + if ('base64' === $encode) { |
|
305 | + header('Content-Encoding: base64'); |
|
306 | + while (!feof($stream)) { |
|
307 | + if (0 !== $length && $read + 8192 > $length) { |
|
308 | + echo base64_encode(fread($stream, $length - $read)); |
|
309 | + exit(); |
|
310 | + } |
|
311 | + |
|
312 | + echo base64_encode(fread($stream, 8192)); |
|
313 | + $read += 8192; |
|
314 | + } |
|
315 | + } else { |
|
316 | + while (!feof($stream)) { |
|
317 | + if (0 !== $length && $read + 8192 > $length) { |
|
318 | + echo fread($stream, $length - $read); |
|
319 | + exit(); |
|
320 | + } |
|
321 | + |
|
322 | + echo fread($stream, 8192); |
|
323 | + $read += 8192; |
|
324 | + } |
|
325 | + } |
|
326 | + }); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -1318,9 +1318,9 @@ discard block |
||
1318 | 1318 | $node->zip($archive); |
1319 | 1319 | } catch (\Exception $e) { |
1320 | 1320 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1321 | - 'category' => get_class($this), |
|
1322 | - 'exception' => $e, |
|
1323 | - ]); |
|
1321 | + 'category' => get_class($this), |
|
1322 | + 'exception' => $e, |
|
1323 | + ]); |
|
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 |
@@ -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 { |