@@ -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 |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | * @param string $attribute |
| 101 | 101 | * @param Closure $decorator |
| 102 | 102 | * |
| 103 | - * @return AttributeDecorator |
|
| 103 | + * @return EventDecorator |
|
| 104 | 104 | */ |
| 105 | 105 | public function addDecorator(string $attribute, Closure $decorator): self |
| 106 | 106 | { |
@@ -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 |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | protected function getAttributes(array $event): array |
| 141 | 141 | { |
| 142 | 142 | return [ |
| 143 | - 'event' => (string) $event['_id'], |
|
| 143 | + 'event' => (string)$event['_id'], |
|
| 144 | 144 | 'timestamp' => $this->dateTimeToUnix($event['timestamp']), |
| 145 | 145 | 'operation' => $event['operation'], |
| 146 | 146 | 'name' => $event['name'], |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | * @param string $attribute |
| 97 | 97 | * @param Closure $decorator |
| 98 | 98 | * |
| 99 | - * @return AttributeDecorator |
|
| 99 | + * @return NodeDecorator |
|
| 100 | 100 | */ |
| 101 | 101 | public function addDecorator(string $attribute, Closure $decorator): self |
| 102 | 102 | { |
@@ -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 |
@@ -136,37 +136,37 @@ discard block |
||
| 136 | 136 | $fs = $this->server->getFilesystem(); |
| 137 | 137 | |
| 138 | 138 | return [ |
| 139 | - 'id' => (string) $attributes['_id'], |
|
| 140 | - 'name' => (string) $attributes['name'], |
|
| 141 | - 'mime' => (string) $attributes['mime'], |
|
| 142 | - 'readonly' => (bool) $attributes['readonly'], |
|
| 139 | + 'id' => (string)$attributes['_id'], |
|
| 140 | + 'name' => (string)$attributes['name'], |
|
| 141 | + 'mime' => (string)$attributes['mime'], |
|
| 142 | + 'readonly' => (bool)$attributes['readonly'], |
|
| 143 | 143 | 'directory' => $node instanceof Collection, |
| 144 | - 'meta' => function ($node) { |
|
| 145 | - return (object) $node->getMetaAttributes(); |
|
| 144 | + 'meta' => function($node) { |
|
| 145 | + return (object)$node->getMetaAttributes(); |
|
| 146 | 146 | }, |
| 147 | - 'size' => function ($node) { |
|
| 147 | + 'size' => function($node) { |
|
| 148 | 148 | return $node->getSize(); |
| 149 | 149 | }, |
| 150 | - 'path' => function ($node) { |
|
| 150 | + 'path' => function($node) { |
|
| 151 | 151 | try { |
| 152 | 152 | return $node->getPath(); |
| 153 | 153 | } catch (\Exception $e) { |
| 154 | 154 | return null; |
| 155 | 155 | } |
| 156 | 156 | }, |
| 157 | - 'parent' => function ($node) { |
|
| 157 | + 'parent' => function($node) { |
|
| 158 | 158 | $id = $node->getAttributes()['parent']; |
| 159 | 159 | |
| 160 | 160 | if (null === $id) { |
| 161 | 161 | return null; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - return (string) $id; |
|
| 164 | + return (string)$id; |
|
| 165 | 165 | }, |
| 166 | - 'access' => function ($node) use ($acl) { |
|
| 166 | + 'access' => function($node) use ($acl) { |
|
| 167 | 167 | return $acl->getAclPrivilege($node); |
| 168 | 168 | }, |
| 169 | - 'share' => function ($node) { |
|
| 169 | + 'share' => function($node) { |
|
| 170 | 170 | if ($node->isShared() || !$node->isSpecial()) { |
| 171 | 171 | return null; |
| 172 | 172 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return null; |
| 178 | 178 | } |
| 179 | 179 | }, |
| 180 | - 'shareowner' => function ($node) use ($server, $fs) { |
|
| 180 | + 'shareowner' => function($node) use ($server, $fs) { |
|
| 181 | 181 | if (!$node->isSpecial()) { |
| 182 | 182 | return null; |
| 183 | 183 | } |
@@ -223,20 +223,20 @@ discard block |
||
| 223 | 223 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
| 224 | 224 | { |
| 225 | 225 | return [ |
| 226 | - 'created' => function ($node) use ($attributes) { |
|
| 226 | + 'created' => function($node) use ($attributes) { |
|
| 227 | 227 | return $this->dateTimeToUnix($attributes['created']); |
| 228 | 228 | }, |
| 229 | - 'changed' => function ($node) use ($attributes) { |
|
| 229 | + 'changed' => function($node) use ($attributes) { |
|
| 230 | 230 | return $this->dateTimeToUnix($attributes['changed']); |
| 231 | 231 | }, |
| 232 | - 'deleted' => function ($node) use ($attributes) { |
|
| 232 | + 'deleted' => function($node) use ($attributes) { |
|
| 233 | 233 | if (false === $attributes['deleted']) { |
| 234 | 234 | return false; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return $this->dateTimeToUnix($attributes['destroy']); |
| 238 | 238 | }, |
| 239 | - 'destroy' => function ($node) use ($attributes) { |
|
| 239 | + 'destroy' => function($node) use ($attributes) { |
|
| 240 | 240 | if (null === $attributes['destroy']) { |
| 241 | 241 | return null; |
| 242 | 242 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * @param string $attribute |
| 81 | 81 | * @param Closure $decorator |
| 82 | 82 | * |
| 83 | - * @return AttributeDecorator |
|
| 83 | + * @return RoleDecorator |
|
| 84 | 84 | */ |
| 85 | 85 | public function addDecorator(string $attribute, Closure $decorator): self |
| 86 | 86 | { |
@@ -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 |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | return [ |
| 108 | - 'created' => function ($role, $requested) use ($attributes) { |
|
| 108 | + 'created' => function($role, $requested) use ($attributes) { |
|
| 109 | 109 | return $attributes['created']->toDateTime()->format('c'); |
| 110 | 110 | }, |
| 111 | - 'changed' => function ($role, $requested) use ($attributes) { |
|
| 111 | + 'changed' => function($role, $requested) use ($attributes) { |
|
| 112 | 112 | return $attributes['changed']->toDateTime()->format('c'); |
| 113 | 113 | }, |
| 114 | - 'deleted' => function ($role, $requested) use ($attributes) { |
|
| 114 | + 'deleted' => function($role, $requested) use ($attributes) { |
|
| 115 | 115 | if (false === $attributes['deleted']) { |
| 116 | 116 | return null; |
| 117 | 117 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | return [ |
| 139 | - 'id' => (string) $attributes['_id'], |
|
| 139 | + 'id' => (string)$attributes['_id'], |
|
| 140 | 140 | 'name' => $attributes['name'], |
| 141 | 141 | 'namespace' => $attributes['namespace'], |
| 142 | 142 | ]; |
@@ -159,19 +159,19 @@ discard block |
||
| 159 | 159 | $user = $this->server->getIdentity(); |
| 160 | 160 | |
| 161 | 161 | return [ |
| 162 | - 'id' => (string) $attributes['_id'], |
|
| 163 | - 'username' => (string) $attributes['username'], |
|
| 164 | - 'name' => (string) $attributes['username'], |
|
| 165 | - 'namespace' => (string) $attributes['namespace'], |
|
| 166 | - 'mail' => (string) $attributes['mail'], |
|
| 167 | - 'avatar' => function ($role, $requested) use ($attributes) { |
|
| 162 | + 'id' => (string)$attributes['_id'], |
|
| 163 | + 'username' => (string)$attributes['username'], |
|
| 164 | + 'name' => (string)$attributes['username'], |
|
| 165 | + 'namespace' => (string)$attributes['namespace'], |
|
| 166 | + 'mail' => (string)$attributes['mail'], |
|
| 167 | + 'avatar' => function($role, $requested) use ($attributes) { |
|
| 168 | 168 | if ($attributes['avatar'] instanceof Binary) { |
| 169 | 169 | return base64_encode($attributes['avatar']->getData()); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return null; |
| 173 | 173 | }, |
| 174 | - 'soft_quota' => function ($role, $requested) use ($attributes, $user) { |
|
| 174 | + 'soft_quota' => function($role, $requested) use ($attributes, $user) { |
|
| 175 | 175 | if ($user === null) { |
| 176 | 176 | return null; |
| 177 | 177 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | return null; |
| 184 | 184 | }, |
| 185 | - 'hard_quota' => function ($role, $requested) use ($attributes, $user) { |
|
| 185 | + 'hard_quota' => function($role, $requested) use ($attributes, $user) { |
|
| 186 | 186 | if ($user === null) { |
| 187 | 187 | return null; |
| 188 | 188 | } |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | * |
| 108 | 108 | * @param string $id |
| 109 | 109 | * @param string $p |
| 110 | - * @param string $version |
|
| 110 | + * @param integer $version |
|
| 111 | 111 | * |
| 112 | 112 | * @return Response |
| 113 | 113 | */ |
@@ -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 |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $wrote = fwrite($session_handler, $data); |
| 310 | 310 | $tmp_size += $wrote; |
| 311 | 311 | |
| 312 | - if ($tmp_size > (int) $this->server->getMaxFileSize()) { |
|
| 312 | + if ($tmp_size > (int)$this->server->getMaxFileSize()) { |
|
| 313 | 313 | fclose($input_handler); |
| 314 | 314 | fclose($session_handler); |
| 315 | 315 | unlink($file); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | try { |
| 344 | 344 | $attributes = compact('changed', 'created', 'readonly', 'meta'); |
| 345 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 345 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 346 | 346 | $attributes = $this->_verifyAttributes($attributes); |
| 347 | 347 | |
| 348 | 348 | return $this->_put($file, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | } else { |
| 355 | 355 | return (new Response())->setCode(206)->setBody([ |
| 356 | - 'session' => (string) $session, |
|
| 356 | + 'session' => (string)$session, |
|
| 357 | 357 | 'size' => $tmp_size, |
| 358 | 358 | 'chunks_left' => $chunks - $index, |
| 359 | 359 | ]); |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $content = fopen('php://input', 'rb'); |
| 464 | 464 | |
| 465 | 465 | $attributes = compact('changed', 'created', 'readonly', 'meta'); |
| 466 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 466 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 467 | 467 | $attributes = $this->_verifyAttributes($attributes); |
| 468 | 468 | |
| 469 | 469 | return $this->_put($content, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -53,8 +53,6 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * Start job. |
| 55 | 55 | * |
| 56 | - * @param Server $server |
|
| 57 | - * @param LoggerInterface $logger |
|
| 58 | 56 | * |
| 59 | 57 | * @return bool |
| 60 | 58 | */ |
@@ -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 |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Balloon\Filesystem\Node\Collection; |
| 21 | 21 | use Balloon\Filesystem\Node\File; |
| 22 | 22 | use Balloon\Server; |
| 23 | -use Balloon\Server\User; |
|
| 24 | 23 | use Micro\Http\Response; |
| 25 | 24 | |
| 26 | 25 | class Documents extends Controller |
@@ -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 |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | foreach ($document->getSessions() as $session) { |
| 103 | 103 | $sessions[] = [ |
| 104 | - 'id' => (string) $session['_id'], |
|
| 104 | + 'id' => (string)$session['_id'], |
|
| 105 | 105 | 'created' => $session['_id']->getTimestamp(), |
| 106 | 106 | 'user' => [ |
| 107 | - 'id' => (string) $session['user'], |
|
| 107 | + 'id' => (string)$session['user'], |
|
| 108 | 108 | 'name' => $this->server->getUserById($session['user'])->getUsername(), |
| 109 | 109 | ], |
| 110 | 110 | ]; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $tpl = new Template($type); |
| 174 | 174 | |
| 175 | 175 | $attributes = compact('readonly', 'meta'); |
| 176 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 176 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 177 | 177 | |
| 178 | 178 | $result = $parent->addFile($name, $tpl->get(), $attributes); |
| 179 | 179 | $result = $this->decorator->decorate($result); |