@@ -70,9 +70,7 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * Add delta event. |
| 72 | 72 | * |
| 73 | - * @param string $name |
|
| 74 | 73 | * @param NodeInterface $node |
| 75 | - * @param array $options |
|
| 76 | 74 | * |
| 77 | 75 | * @return ObjectId |
| 78 | 76 | */ |
@@ -359,7 +357,8 @@ discard block |
||
| 359 | 357 | /** |
| 360 | 358 | * Get delta feed filter. |
| 361 | 359 | * |
| 362 | - * @param array $cursor |
|
| 360 | + * @param integer[] $cursor |
|
| 361 | + * @param NodeInterface|null $node |
|
| 363 | 362 | * |
| 364 | 363 | * @return array |
| 365 | 364 | */ |
@@ -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 |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | foreach ($query['result'] as $log) { |
| 248 | 248 | if (false === $query['has_more']) { |
| 249 | - $query['last_id'] = (string) $log['_id']; |
|
| 250 | - $query['last_ts'] = (string) $log['timestamp']; |
|
| 249 | + $query['last_id'] = (string)$log['_id']; |
|
| 250 | + $query['last_ts'] = (string)$log['timestamp']; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | try { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $deleted_node = [ |
| 295 | - 'id' => (string) $log['node'], |
|
| 295 | + 'id' => (string)$log['node'], |
|
| 296 | 296 | 'deleted' => true, |
| 297 | 297 | 'created' => null, |
| 298 | 298 | 'changed' => $log['timestamp'], |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | $filter = $this->buildDeltaFeedFilter($cursor, $limit, $node); |
| 406 | 406 | |
| 407 | 407 | $result = $this->db->delta->find($filter, [ |
| 408 | - 'skip' => (int) $cursor[1], |
|
| 409 | - 'limit' => (int) $limit, |
|
| 408 | + 'skip' => (int)$cursor[1], |
|
| 409 | + 'limit' => (int)$limit, |
|
| 410 | 410 | 'sort' => ['timestamp' => 1], |
| 411 | 411 | ]); |
| 412 | 412 | |
| 413 | 413 | $left = $this->db->delta->count($filter, [ |
| 414 | - 'skip' => (int) $cursor[1], |
|
| 414 | + 'skip' => (int)$cursor[1], |
|
| 415 | 415 | 'sort' => ['timestamp' => 1], |
| 416 | 416 | ]); |
| 417 | 417 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | $entry = [ |
| 457 | - 'id' => (string) $event['node'], |
|
| 457 | + 'id' => (string)$event['node'], |
|
| 458 | 458 | 'deleted' => true, |
| 459 | 459 | 'created' => null, |
| 460 | 460 | 'changed' => $event['timestamp'], |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | if (5 !== count($cursor)) { |
| 553 | 553 | return null; |
| 554 | 554 | } |
| 555 | - $cursor[1] = (int) $cursor[1]; |
|
| 555 | + $cursor[1] = (int)$cursor[1]; |
|
| 556 | 556 | |
| 557 | 557 | return $cursor; |
| 558 | 558 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * @param string $attribute |
| 44 | 44 | * @param Closure $decorator |
| 45 | 45 | * |
| 46 | - * @return AttributeDecorator |
|
| 46 | + * @return DeltaAttributeDecorator |
|
| 47 | 47 | */ |
| 48 | 48 | public function addDecorator(string $attribute, Closure $decorator): self |
| 49 | 49 | { |
@@ -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 |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | protected function getAttributes(array $node): array |
| 63 | 63 | { |
| 64 | 64 | return [ |
| 65 | - 'id' => (string) $node['id'], |
|
| 65 | + 'id' => (string)$node['id'], |
|
| 66 | 66 | 'deleted' => $node['deleted'], |
| 67 | 67 | 'changed' => $node['changed']->toDateTime()->format('c'), |
| 68 | 68 | 'path' => $node['path'], |
@@ -816,7 +816,6 @@ discard block |
||
| 816 | 816 | /** |
| 817 | 817 | * Set app attributes. |
| 818 | 818 | * |
| 819 | - * @param AppInterface $app |
|
| 820 | 819 | * @param array $attributes |
| 821 | 820 | * |
| 822 | 821 | * @return NodeInterface |
@@ -832,7 +831,6 @@ discard block |
||
| 832 | 831 | /** |
| 833 | 832 | * Set app attribute. |
| 834 | 833 | * |
| 835 | - * @param AppInterface $app |
|
| 836 | 834 | * @param string $attribute |
| 837 | 835 | * @param mixed $value |
| 838 | 836 | * |
@@ -853,7 +851,6 @@ discard block |
||
| 853 | 851 | /** |
| 854 | 852 | * Remove app attribute. |
| 855 | 853 | * |
| 856 | - * @param AppInterface $app |
|
| 857 | 854 | * |
| 858 | 855 | * @return NodeInterface |
| 859 | 856 | */ |
@@ -870,7 +867,6 @@ discard block |
||
| 870 | 867 | /** |
| 871 | 868 | * Remove app attribute. |
| 872 | 869 | * |
| 873 | - * @param AppInterface $app |
|
| 874 | 870 | * @param string $attribute |
| 875 | 871 | * |
| 876 | 872 | * @return NodeInterface |
@@ -888,7 +884,6 @@ discard block |
||
| 888 | 884 | /** |
| 889 | 885 | * Get app attribute. |
| 890 | 886 | * |
| 891 | - * @param AppInterface $app |
|
| 892 | 887 | * @param string $attribute |
| 893 | 888 | * |
| 894 | 889 | * @return mixed |
@@ -905,7 +900,6 @@ discard block |
||
| 905 | 900 | /** |
| 906 | 901 | * Get app attributes. |
| 907 | 902 | * |
| 908 | - * @param AppInterface $app |
|
| 909 | 903 | * |
| 910 | 904 | * @return array |
| 911 | 905 | */ |
@@ -944,7 +938,7 @@ discard block |
||
| 944 | 938 | /** |
| 945 | 939 | * Get meta attributes as array. |
| 946 | 940 | * |
| 947 | - * @param array $attribute Specify attributes to return |
|
| 941 | + * @param array $attributes Specify attributes to return |
|
| 948 | 942 | * |
| 949 | 943 | * @return array |
| 950 | 944 | */ |
@@ -1115,9 +1109,9 @@ discard block |
||
| 1115 | 1109 | /** |
| 1116 | 1110 | * Get array value via string path. |
| 1117 | 1111 | * |
| 1118 | - * @param iterable $arr |
|
| 1112 | + * @param iterable $array |
|
| 1119 | 1113 | * @param string $path |
| 1120 | - * @param string $seperator |
|
| 1114 | + * @param string $separator |
|
| 1121 | 1115 | * |
| 1122 | 1116 | * @return mixed |
| 1123 | 1117 | */ |
@@ -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 |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | foreach ($config as $option => $value) { |
| 110 | 110 | switch ($option) { |
| 111 | 111 | case 'size_limit': |
| 112 | - $this->size_limit = (int) $value; |
|
| 112 | + $this->size_limit = (int)$value; |
|
| 113 | 113 | |
| 114 | 114 | break; |
| 115 | 115 | default: |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | ]); |
| 218 | 218 | |
| 219 | 219 | $params = [ |
| 220 | - 'id' => (string) $node, |
|
| 220 | + 'id' => (string)$node, |
|
| 221 | 221 | 'type' => 'storage', |
| 222 | 222 | 'index' => $this->es->getIndex(), |
| 223 | 223 | ]; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | ]); |
| 243 | 243 | |
| 244 | 244 | $params = [ |
| 245 | - 'id' => (string) $node, |
|
| 245 | + 'id' => (string)$node, |
|
| 246 | 246 | 'type' => 'storage', |
| 247 | 247 | 'index' => $this->es->getIndex(), |
| 248 | 248 | ]; |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | protected function setMemoryLimit(): self |
| 265 | 265 | { |
| 266 | - $limit = (int) ini_get('memory_limit') * 1024 * 1024; |
|
| 266 | + $limit = (int)ini_get('memory_limit') * 1024 * 1024; |
|
| 267 | 267 | $required = $this->size_limit * 2; |
| 268 | 268 | if ($limit !== -1 && $limit < $limit + $required) { |
| 269 | - ini_set('memory_limit', (string) (($limit + $required) * 1024 * 1024)); |
|
| 269 | + ini_set('memory_limit', (string)(($limit + $required) * 1024 * 1024)); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | return $this; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | { |
| 284 | 284 | return [ |
| 285 | 285 | 'index' => $this->es->getIndex(), |
| 286 | - 'id' => (string) $node->getId(), |
|
| 286 | + 'id' => (string)$node->getId(), |
|
| 287 | 287 | 'type' => 'storage', |
| 288 | 288 | ]; |
| 289 | 289 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | { |
| 301 | 301 | $params = [ |
| 302 | 302 | 'index' => $this->es->getIndex(), |
| 303 | - 'id' => (string) $storage_reference['_id'], |
|
| 303 | + 'id' => (string)$storage_reference['_id'], |
|
| 304 | 304 | 'type' => 'fs', |
| 305 | 305 | ]; |
| 306 | 306 | |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | $content = json_encode(base64_encode(stream_get_contents($node->get()))); |
| 343 | 343 | |
| 344 | 344 | $metadata = $meta['metadata']; |
| 345 | - array_walk_recursive($metadata, function (&$value) { $value = (string) $value; }); |
|
| 345 | + array_walk_recursive($metadata, function(&$value) { $value = (string)$value; }); |
|
| 346 | 346 | |
| 347 | 347 | $params = [ |
| 348 | 348 | 'index' => $this->es->getIndex(), |
| 349 | - 'id' => (string) $meta['_id'], |
|
| 349 | + 'id' => (string)$meta['_id'], |
|
| 350 | 350 | 'type' => 'fs', |
| 351 | 351 | 'body' => [ |
| 352 | 352 | 'metadata' => $metadata, |
@@ -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 |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->prependRoute(new Route('/api/v2/files/convert', Convert::class)) |
| 35 | 35 | ->prependRoute(new Route('/api/v2/files/{id:#([0-9a-z]{24})#}/convert', Convert::class)); |
| 36 | 36 | |
| 37 | - $decorator->addDecorator('master', function ($node) use ($fs, $decorator) { |
|
| 37 | + $decorator->addDecorator('master', function($node) use ($fs, $decorator) { |
|
| 38 | 38 | $master = $node->getAppAttribute('Balloon\\App\\Convert', 'master'); |
| 39 | 39 | if (null === $master) { |
| 40 | 40 | return null; |
@@ -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 |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | case 'github_request_url': |
| 94 | 94 | case 'github_request_timeout': |
| 95 | 95 | case 'github_request_useragent': |
| 96 | - $this->{$option} = (string) $value; |
|
| 96 | + $this->{$option} = (string)$value; |
|
| 97 | 97 | |
| 98 | 98 | break; |
| 99 | 99 | case 'github_request_timeout': |
| 100 | - $this->github_request_timeout = (int) $value; |
|
| 100 | + $this->github_request_timeout = (int)$value; |
|
| 101 | 101 | |
| 102 | 102 | break; |
| 103 | 103 | case 'formats': |
@@ -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 |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ->setHeader('Content-Type', 'application/octet-stream') |
| 65 | 65 | ->setHeader('Content-Transfer-Encoding', 'binary') |
| 66 | 66 | ->setOutputFormat(null) |
| 67 | - ->setBody(function () use ($url) { |
|
| 67 | + ->setBody(function() use ($url) { |
|
| 68 | 68 | $stream = fopen($url, 'r'); |
| 69 | 69 | while (!feof($stream)) { |
| 70 | 70 | echo fread($stream, 8192); |
@@ -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 |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | - $decorator->addDecorator('sharelink_token', function ($node) use ($sharelink) { |
|
| 73 | + $decorator->addDecorator('sharelink_token', function($node) use ($sharelink) { |
|
| 74 | 74 | $attributes = $sharelink->getSharelink($node); |
| 75 | 75 | |
| 76 | 76 | if (isset($attributes['token'])) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | - $decorator->addDecorator('sharelink_expire', function ($node) use ($sharelink) { |
|
| 81 | + $decorator->addDecorator('sharelink_expire', function($node) use ($sharelink) { |
|
| 82 | 82 | $attributes = $sharelink->getSharelink($node); |
| 83 | 83 | |
| 84 | 84 | if (isset($attributes['expiration'])) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if (isset($_GET['t']) && !empty($_GET['t'])) { |
| 103 | 103 | $token = $_GET['t']; |
| 104 | 104 | if (isset($_GET['download'])) { |
| 105 | - $download = (bool) $_GET['download']; |
|
| 105 | + $download = (bool)$_GET['download']; |
|
| 106 | 106 | } else { |
| 107 | 107 | $download = false; |
| 108 | 108 | } |
@@ -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 |
@@ -33,35 +33,35 @@ discard block |
||
| 33 | 33 | ->prependRoute(new Route('/api/v2/notifications', Api::class)) |
| 34 | 34 | ->prependRoute(new Route('/api/v2/notifications/{id:#([0-9a-z]{24})#}', Api::class)); |
| 35 | 35 | |
| 36 | - $decorator->addDecorator('subscription', function ($node) use ($server) { |
|
| 36 | + $decorator->addDecorator('subscription', function($node) use ($server) { |
|
| 37 | 37 | $subscription = $node->getAppAttribute('Balloon\\App\\Notification', 'subscription'); |
| 38 | 38 | |
| 39 | 39 | if (is_array($subscription)) { |
| 40 | - return isset($subscription[(string) $server->getIdentity()->getId()]); |
|
| 40 | + return isset($subscription[(string)$server->getIdentity()->getId()]); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return false; |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - $decorator->addDecorator('subscription_exclude_me', function ($node) use ($server) { |
|
| 46 | + $decorator->addDecorator('subscription_exclude_me', function($node) use ($server) { |
|
| 47 | 47 | $subscription = $node->getAppAttribute('Balloon\\App\\Notification', 'subscription'); |
| 48 | 48 | |
| 49 | - if (is_array($subscription) && isset($subscription[(string) $server->getIdentity()->getId()]['exclude_me'])) { |
|
| 50 | - return $subscription[(string) $server->getIdentity()->getId()]['exclude_me']; |
|
| 49 | + if (is_array($subscription) && isset($subscription[(string)$server->getIdentity()->getId()]['exclude_me'])) { |
|
| 50 | + return $subscription[(string)$server->getIdentity()->getId()]['exclude_me']; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return false; |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - $decorator->addDecorator('subscription_recursive', function ($node) use ($server) { |
|
| 56 | + $decorator->addDecorator('subscription_recursive', function($node) use ($server) { |
|
| 57 | 57 | if (!($node instanceof Collection)) { |
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $subscription = $node->getAppAttribute('Balloon\\App\\Notification', 'subscription'); |
| 62 | 62 | |
| 63 | - if (is_array($subscription) && isset($subscription[(string) $server->getIdentity()->getId()]['recursive'])) { |
|
| 64 | - return $subscription[(string) $server->getIdentity()->getId()]['recursive']; |
|
| 63 | + if (is_array($subscription) && isset($subscription[(string)$server->getIdentity()->getId()]['recursive'])) { |
|
| 64 | + return $subscription[(string)$server->getIdentity()->getId()]['recursive']; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return false; |