@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | $role_decorator = $this->role_decorator; |
100 | 100 | |
101 | 101 | return [ |
102 | - 'id' => (string) $message['_id'], |
|
103 | - 'message' => (string) $message['body'], |
|
104 | - 'subject' => (string) $message['subject'], |
|
105 | - 'sender' => function ($message) use ($server, $role_decorator) { |
|
102 | + 'id' => (string)$message['_id'], |
|
103 | + 'message' => (string)$message['body'], |
|
104 | + 'subject' => (string)$message['subject'], |
|
105 | + 'sender' => function($message) use ($server, $role_decorator) { |
|
106 | 106 | try { |
107 | 107 | return $role_decorator->decorate($server->getUserById($message['sender']), ['_links', 'id', 'username']); |
108 | 108 | } catch (\Exception $e) { |
@@ -279,52 +279,52 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | return $response |
282 | - ->setOutputFormat(null) |
|
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | - $stream = $node->get(); |
|
285 | - $name = $node->getName(); |
|
282 | + ->setOutputFormat(null) |
|
283 | + ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | + $stream = $node->get(); |
|
285 | + $name = $node->getName(); |
|
286 | 286 | |
287 | - if (null === $stream) { |
|
288 | - echo ''; |
|
287 | + if (null === $stream) { |
|
288 | + echo ''; |
|
289 | 289 | |
290 | - return; |
|
291 | - } |
|
290 | + return; |
|
291 | + } |
|
292 | 292 | |
293 | - if (0 !== $offset) { |
|
294 | - if (fseek($stream, $offset) === -1) { |
|
295 | - throw new Exception\Conflict( |
|
293 | + if (0 !== $offset) { |
|
294 | + if (fseek($stream, $offset) === -1) { |
|
295 | + throw new Exception\Conflict( |
|
296 | 296 | 'invalid offset requested', |
297 | 297 | Exception\Conflict::INVALID_OFFSET |
298 | 298 | ); |
299 | - } |
|
300 | - } |
|
301 | - |
|
302 | - $read = 0; |
|
303 | - if ('base64' === $encode) { |
|
304 | - header('Content-Encoding: base64'); |
|
305 | - while (!feof($stream)) { |
|
306 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
307 | - echo base64_encode(fread($stream, $limit - $read)); |
|
308 | - exit(); |
|
309 | - } |
|
310 | - |
|
311 | - echo base64_encode(fread($stream, 8192)); |
|
312 | - $read += 8192; |
|
313 | - } |
|
314 | - } else { |
|
315 | - while (!feof($stream)) { |
|
316 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
317 | - echo fread($stream, $limit - $read); |
|
318 | - exit(); |
|
319 | - } |
|
320 | - |
|
321 | - echo fread($stream, 8192); |
|
322 | - $read += 8192; |
|
323 | - } |
|
324 | - |
|
325 | - exit(); |
|
326 | - } |
|
327 | - }); |
|
299 | + } |
|
300 | + } |
|
301 | + |
|
302 | + $read = 0; |
|
303 | + if ('base64' === $encode) { |
|
304 | + header('Content-Encoding: base64'); |
|
305 | + while (!feof($stream)) { |
|
306 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
307 | + echo base64_encode(fread($stream, $limit - $read)); |
|
308 | + exit(); |
|
309 | + } |
|
310 | + |
|
311 | + echo base64_encode(fread($stream, 8192)); |
|
312 | + $read += 8192; |
|
313 | + } |
|
314 | + } else { |
|
315 | + while (!feof($stream)) { |
|
316 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
317 | + echo fread($stream, $limit - $read); |
|
318 | + exit(); |
|
319 | + } |
|
320 | + |
|
321 | + echo fread($stream, 8192); |
|
322 | + $read += 8192; |
|
323 | + } |
|
324 | + |
|
325 | + exit(); |
|
326 | + } |
|
327 | + }); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -1129,9 +1129,9 @@ discard block |
||
1129 | 1129 | $node->zip($archive); |
1130 | 1130 | } catch (\Exception $e) { |
1131 | 1131 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1132 | - 'category' => get_class($this), |
|
1133 | - 'exception' => $e, |
|
1134 | - ]); |
|
1132 | + 'category' => get_class($this), |
|
1133 | + 'exception' => $e, |
|
1134 | + ]); |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $result = $this->_getNode($id, $p, null, false, false, $deleted); |
123 | 123 | |
124 | 124 | $response = (new Response()) |
125 | - ->setHeader('Content-Length', (string) $result->getSize()) |
|
125 | + ->setHeader('Content-Length', (string)$result->getSize()) |
|
126 | 126 | ->setHeader('Content-Type', $result->getContentType()) |
127 | 127 | ->setCode(200); |
128 | 128 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
190 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
191 | 191 | if (true === $move) { |
192 | 192 | $node = $node->setParent($parent, $conflict); |
193 | 193 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $response->setHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($node->getName())); |
272 | 272 | $response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
273 | 273 | $response->setHeader('Content-Type', 'application/octet-stream'); |
274 | - $response->setHeader('Content-Length', (string) $node->getSize()); |
|
274 | + $response->setHeader('Content-Length', (string)$node->getSize()); |
|
275 | 275 | $response->setHeader('Content-Transfer-Encoding', 'binary'); |
276 | 276 | } else { |
277 | 277 | $response->setHeader('Content-Disposition', 'inline; filename*=UTF-8\'\''.rawurlencode($node->getName())); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | return $response |
282 | 282 | ->setOutputFormat(null) |
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
283 | + ->setBody(function() use ($node, $encode, $offset, $limit) { |
|
284 | 284 | $stream = $node->get(); |
285 | 285 | $name = $node->getName(); |
286 | 286 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
357 | 357 | { |
358 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
358 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
359 | 359 | $node->setReadonly($readonly); |
360 | 360 | |
361 | 361 | return [ |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function patchMeta(array $attributes, ?string $id = null, ?string $p = null): Response |
588 | 588 | { |
589 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
589 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
590 | 590 | $node->setMetaAttributes($attributes); |
591 | 591 | |
592 | 592 | return [ |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | ); |
684 | 684 | } |
685 | 685 | |
686 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
686 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
687 | 687 | $parent = $node->getParent(); |
688 | 688 | $result = $node->copyTo($parent, $conflict); |
689 | 689 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | ); |
749 | 749 | } |
750 | 750 | |
751 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
751 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
752 | 752 | $result = $node->setParent($parent, $conflict); |
753 | 753 | |
754 | 754 | return [ |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
803 | 803 | } |
804 | 804 | |
805 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
805 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
806 | 806 | if (null === $at) { |
807 | 807 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
808 | 808 | } else { |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | foreach ($attributes as $attribute => $value) { |
1172 | 1172 | switch ($attribute) { |
1173 | 1173 | case 'filter': |
1174 | - $attributes['filter'] = json_encode((array) $attributes['filter']); |
|
1174 | + $attributes['filter'] = json_encode((array)$attributes['filter']); |
|
1175 | 1175 | |
1176 | 1176 | break; |
1177 | 1177 | case 'destroy': |
@@ -1186,14 +1186,14 @@ discard block |
||
1186 | 1186 | if (!Helper::isValidTimestamp($value)) { |
1187 | 1187 | throw new Exception\InvalidArgument($attribute.' Changed timestamp must be valid unix timestamp'); |
1188 | 1188 | } |
1189 | - if ((int) $value > time()) { |
|
1189 | + if ((int)$value > time()) { |
|
1190 | 1190 | throw new Exception\InvalidArgument($attribute.' timestamp can not be set greater than the server time'); |
1191 | 1191 | } |
1192 | 1192 | $attributes[$attribute] = new UTCDateTime($value.'000'); |
1193 | 1193 | |
1194 | 1194 | break; |
1195 | 1195 | case 'readonly': |
1196 | - $attributes['readonly'] = (bool) $attributes['readonly']; |
|
1196 | + $attributes['readonly'] = (bool)$attributes['readonly']; |
|
1197 | 1197 | |
1198 | 1198 | break; |
1199 | 1199 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | 'type' => $rule['role'] instanceof User ? 'user' : 'group', |
182 | 182 | 'priv' => $rule['privilege'], |
183 | 183 | 'name' => $role['name'], |
184 | - 'id' => (string) $rule['id'], |
|
184 | + 'id' => (string)$rule['id'], |
|
185 | 185 | ]; |
186 | 186 | } |
187 | 187 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | return (new Response())->setCode(201)->setBody([ |
352 | 352 | 'code' => 201, |
353 | - 'data' => (string) $result, |
|
353 | + 'data' => (string)$result, |
|
354 | 354 | ]); |
355 | 355 | } |
356 | 356 | if (null !== $id && null === $name) { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | return (new Response())->setCode(201)->setBody([ |
368 | 368 | 'code' => 201, |
369 | - 'data' => (string) $result, |
|
369 | + 'data' => (string)$result, |
|
370 | 370 | ]); |
371 | 371 | } |
372 | 372 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * balloon |