@@ -209,6 +209,7 @@ |
||
| 209 | 209 | /** |
| 210 | 210 | * Filesystem factory. |
| 211 | 211 | * |
| 212 | + * @param User $user |
|
| 212 | 213 | * @return Filesystem |
| 213 | 214 | */ |
| 214 | 215 | public function getFilesystem(?User $user = null): Filesystem |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | $this->identity = $user; |
| 533 | 533 | $user->updateIdentity($identity) |
| 534 | - ->updateShares(); |
|
| 534 | + ->updateShares(); |
|
| 535 | 535 | $this->hook->run('postServerIdentity', [$user]); |
| 536 | 536 | |
| 537 | 537 | return true; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | public function getGroupByName(string $name): Group |
| 663 | 663 | { |
| 664 | 664 | $group = $this->db->group->findOne([ |
| 665 | - 'name' => $name, |
|
| 665 | + 'name' => $name, |
|
| 666 | 666 | ]); |
| 667 | 667 | |
| 668 | 668 | if (null === $group) { |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | public function getGroupById(ObjectId $id): Group |
| 683 | 683 | { |
| 684 | 684 | $group = $this->db->group->findOne([ |
| 685 | - '_id' => $id, |
|
| 685 | + '_id' => $id, |
|
| 686 | 686 | ]); |
| 687 | 687 | |
| 688 | 688 | if (null === $group) { |
@@ -265,6 +265,8 @@ |
||
| 265 | 265 | /** |
| 266 | 266 | * Get resolved member. |
| 267 | 267 | * |
| 268 | + * @param integer $offset |
|
| 269 | + * @param integer $limit |
|
| 268 | 270 | * @return Generator |
| 269 | 271 | */ |
| 270 | 272 | public function getResolvedMembers(?int $offset = null, ?int $limit = null): ?Generator |
@@ -722,6 +722,8 @@ |
||
| 722 | 722 | /** |
| 723 | 723 | * Get resolved groups. |
| 724 | 724 | * |
| 725 | + * @param integer $offset |
|
| 726 | + * @param integer $limit |
|
| 725 | 727 | * @return Generator |
| 726 | 728 | */ |
| 727 | 729 | public function getResolvedGroups(?int $offset = null, ?int $limit = null): ?Generator |
@@ -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 |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $acl[] = [ |
| 59 | 59 | 'type' => 'group', |
| 60 | 60 | 'privilege' => $rule['priv'] === 'w' ? 'w+' : $rule['priv'], |
| 61 | - 'id' => (string) $group['_id'], |
|
| 61 | + 'id' => (string)$group['_id'], |
|
| 62 | 62 | ]; |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $acl[] = [ |
| 78 | 78 | 'type' => 'user', |
| 79 | 79 | 'privilege' => $rule['priv'] === 'w' ? 'w+' : $rule['priv'], |
| 80 | - 'id' => (string) $user['_id'], |
|
| 80 | + 'id' => (string)$user['_id'], |
|
| 81 | 81 | ]; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -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 |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return [ |
| 105 | - 'created' => function ($role) use ($attributes) { |
|
| 105 | + 'created' => function($role) use ($attributes) { |
|
| 106 | 106 | return $attributes['created']->toDateTime()->format('c'); |
| 107 | 107 | }, |
| 108 | - 'changed' => function ($role) use ($attributes) { |
|
| 108 | + 'changed' => function($role) use ($attributes) { |
|
| 109 | 109 | return $attributes['changed']->toDateTime()->format('c'); |
| 110 | 110 | }, |
| 111 | - 'deleted' => function ($role) use ($attributes) { |
|
| 111 | + 'deleted' => function($role) use ($attributes) { |
|
| 112 | 112 | if (false === $attributes['deleted']) { |
| 113 | 113 | return null; |
| 114 | 114 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return [ |
| 136 | - 'id' => (string) $attributes['_id'], |
|
| 136 | + 'id' => (string)$attributes['_id'], |
|
| 137 | 137 | 'name' => $attributes['name'], |
| 138 | 138 | 'namespace' => $attributes['namespace'], |
| 139 | 139 | ]; |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | $user = $this->server->getIdentity(); |
| 157 | 157 | |
| 158 | 158 | return [ |
| 159 | - 'id' => (string) $attributes['_id'], |
|
| 160 | - 'username' => (string) $attributes['username'], |
|
| 161 | - 'name' => (string) $attributes['username'], |
|
| 162 | - 'namespace' => (string) $attributes['namespace'], |
|
| 163 | - 'mail' => (string) $attributes['mail'], |
|
| 164 | - 'quota' => function ($role) use ($attributes, $user) { |
|
| 159 | + 'id' => (string)$attributes['_id'], |
|
| 160 | + 'username' => (string)$attributes['username'], |
|
| 161 | + 'name' => (string)$attributes['username'], |
|
| 162 | + 'namespace' => (string)$attributes['namespace'], |
|
| 163 | + 'mail' => (string)$attributes['mail'], |
|
| 164 | + 'quota' => function($role) use ($attributes, $user) { |
|
| 165 | 165 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
| 166 | 166 | return $role->getQuotaUsage(); |
| 167 | 167 | } |
@@ -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,22 +99,22 @@ discard block |
||
| 99 | 99 | foreach ($config as $option => $value) { |
| 100 | 100 | switch ($option) { |
| 101 | 101 | case 'socket': |
| 102 | - $this->socket = (string) $value; |
|
| 102 | + $this->socket = (string)$value; |
|
| 103 | 103 | |
| 104 | 104 | break; |
| 105 | 105 | case 'max_stream_size': |
| 106 | - $this->max_stream_size = (int) $value; |
|
| 106 | + $this->max_stream_size = (int)$value; |
|
| 107 | 107 | |
| 108 | 108 | break; |
| 109 | 109 | case 'aggressiveness': |
| 110 | - if ((int) $value > 3 || (int) $value < 0) { |
|
| 111 | - throw new InvalidArgumentException('invalid config value ['.(int) $value.'] for aggressiveness'); |
|
| 110 | + if ((int)$value > 3 || (int)$value < 0) { |
|
| 111 | + throw new InvalidArgumentException('invalid config value ['.(int)$value.'] for aggressiveness'); |
|
| 112 | 112 | } |
| 113 | - $this->aggressiveness = (int) $value; |
|
| 113 | + $this->aggressiveness = (int)$value; |
|
| 114 | 114 | |
| 115 | 115 | break; |
| 116 | 116 | case 'timeout': |
| 117 | - $this->timeout = (int) $value; |
|
| 117 | + $this->timeout = (int)$value; |
|
| 118 | 118 | |
| 119 | 119 | break; |
| 120 | 120 | break; |
@@ -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 |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | foreach ($config as $option => $value) { |
| 111 | 111 | switch ($option) { |
| 112 | 112 | case 'size_limit': |
| 113 | - $this->size_limit = (int) $value; |
|
| 113 | + $this->size_limit = (int)$value; |
|
| 114 | 114 | |
| 115 | 115 | break; |
| 116 | 116 | default: |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | ]); |
| 219 | 219 | |
| 220 | 220 | $params = [ |
| 221 | - 'id' => (string) $node, |
|
| 221 | + 'id' => (string)$node, |
|
| 222 | 222 | 'type' => 'storage', |
| 223 | 223 | 'index' => $this->es->getIndex(), |
| 224 | 224 | ]; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | ]); |
| 244 | 244 | |
| 245 | 245 | $params = [ |
| 246 | - 'id' => (string) $node, |
|
| 246 | + 'id' => (string)$node, |
|
| 247 | 247 | 'type' => 'storage', |
| 248 | 248 | 'index' => $this->es->getIndex(), |
| 249 | 249 | ]; |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | protected function setMemoryLimit(): self |
| 266 | 266 | { |
| 267 | - $limit = (int) ini_get('memory_limit') * 1024 * 1024; |
|
| 267 | + $limit = (int)ini_get('memory_limit') * 1024 * 1024; |
|
| 268 | 268 | $required = $this->size_limit * 2; |
| 269 | 269 | if ($limit !== -1 && $limit < $limit + $required) { |
| 270 | - ini_set('memory_limit', (string) (($limit + $required) * 1024 * 1024)); |
|
| 270 | + ini_set('memory_limit', (string)(($limit + $required) * 1024 * 1024)); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | return $this; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | return [ |
| 286 | 286 | 'index' => $this->es->getIndex(), |
| 287 | - 'id' => (string) $node->getId(), |
|
| 287 | + 'id' => (string)$node->getId(), |
|
| 288 | 288 | 'type' => 'storage', |
| 289 | 289 | ]; |
| 290 | 290 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | { |
| 302 | 302 | $params = [ |
| 303 | 303 | 'index' => $this->es->getIndex(), |
| 304 | - 'id' => (string) $storage_reference['_id'], |
|
| 304 | + 'id' => (string)$storage_reference['_id'], |
|
| 305 | 305 | 'type' => 'fs', |
| 306 | 306 | ]; |
| 307 | 307 | |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | $content = base64_encode(stream_get_contents($node->get())); |
| 344 | 344 | |
| 345 | 345 | $metadata = $meta['metadata']; |
| 346 | - array_walk_recursive($metadata, function (&$value) { $value = (string) $value; }); |
|
| 346 | + array_walk_recursive($metadata, function(&$value) { $value = (string)$value; }); |
|
| 347 | 347 | |
| 348 | 348 | $params = [ |
| 349 | 349 | 'index' => $this->es->getIndex(), |
| 350 | - 'id' => (string) $meta['_id'], |
|
| 350 | + 'id' => (string)$meta['_id'], |
|
| 351 | 351 | 'type' => 'fs', |
| 352 | 352 | 'body' => [ |
| 353 | 353 | '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 |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | foreach ($config as $option => $value) { |
| 96 | 96 | switch ($option) { |
| 97 | 97 | case 'server': |
| 98 | - $this->es_server = (array) $value; |
|
| 98 | + $this->es_server = (array)$value; |
|
| 99 | 99 | |
| 100 | 100 | break; |
| 101 | 101 | case 'index': |
| 102 | - $this->es_index = (string) $value; |
|
| 102 | + $this->es_index = (string)$value; |
|
| 103 | 103 | |
| 104 | 104 | break; |
| 105 | 105 | default: |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | $bool = $query['body']['query']; |
| 205 | 205 | |
| 206 | 206 | $filter1 = []; |
| 207 | - $filter1['bool']['should'][]['term']['owner'] = (string) $this->user->getId(); |
|
| 208 | - $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string) $this->user->getId(); |
|
| 207 | + $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId(); |
|
| 208 | + $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string)$this->user->getId(); |
|
| 209 | 209 | |
| 210 | 210 | $share_filter = [ |
| 211 | 211 | 'bool' => [ |
@@ -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(/|\z)', Convert::class)) |
| 35 | 35 | ->prependRoute(new Route('/api/v2/files/{id:#([0-9a-z]{24})#}/convert(/|\z)', Convert::class)); |
| 36 | 36 | |
| 37 | - $node_decorator->addDecorator('master', function ($node) use ($convert_decorator, $converter) { |
|
| 37 | + $node_decorator->addDecorator('master', function($node) use ($convert_decorator, $converter) { |
|
| 38 | 38 | $master = $node->getAppAttribute('Balloon\\App\\Convert', 'master'); |
| 39 | 39 | if (null === $master) { |
| 40 | 40 | return null; |