@@ -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 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * balloon |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param array|string $id |
| 283 | 283 | * @param array|string $p |
| 284 | 284 | * @param int $offset |
| 285 | - * @param int $legnth |
|
| 285 | + * @param int $length |
|
| 286 | 286 | * @param string $encode |
| 287 | 287 | * @param bool $download |
| 288 | 288 | * @param string $name |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | * @param string $class Force set node type |
| 1421 | 1421 | * @param bool $multiple Allow $id to be an array |
| 1422 | 1422 | * @param bool $allow_root Allow instance of root collection |
| 1423 | - * @param bool $deleted How to handle deleted node |
|
| 1423 | + * @param integer $deleted How to handle deleted node |
|
| 1424 | 1424 | * |
| 1425 | 1425 | * @return NodeInterface |
| 1426 | 1426 | */ |
@@ -1454,7 +1454,7 @@ discard block |
||
| 1454 | 1454 | * @param string $id |
| 1455 | 1455 | * @param string $path |
| 1456 | 1456 | * @param string $class Force set node type |
| 1457 | - * @param bool $deleted How to handle deleted node |
|
| 1457 | + * @param integer $deleted How to handle deleted node |
|
| 1458 | 1458 | * |
| 1459 | 1459 | * @return Generator |
| 1460 | 1460 | */ |
@@ -320,50 +320,50 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | return (new Response()) |
| 323 | - ->setOutputFormat(null) |
|
| 324 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 325 | - $mime = $node->getContentType(); |
|
| 326 | - $stream = $node->get(); |
|
| 327 | - $name = $node->getName(); |
|
| 328 | - |
|
| 329 | - if (null === $stream) { |
|
| 330 | - return; |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - if (0 !== $offset) { |
|
| 334 | - if (fseek($stream, $offset) === -1) { |
|
| 335 | - throw new Exception\Conflict( |
|
| 323 | + ->setOutputFormat(null) |
|
| 324 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 325 | + $mime = $node->getContentType(); |
|
| 326 | + $stream = $node->get(); |
|
| 327 | + $name = $node->getName(); |
|
| 328 | + |
|
| 329 | + if (null === $stream) { |
|
| 330 | + return; |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + if (0 !== $offset) { |
|
| 334 | + if (fseek($stream, $offset) === -1) { |
|
| 335 | + throw new Exception\Conflict( |
|
| 336 | 336 | 'invalid offset requested', |
| 337 | 337 | Exception\Conflict::INVALID_OFFSET |
| 338 | 338 | ); |
| 339 | - } |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - $read = 0; |
|
| 343 | - header('Content-Type: '.$mime.''); |
|
| 344 | - if ('base64' === $encode) { |
|
| 345 | - header('Content-Encoding: base64'); |
|
| 346 | - while (!feof($stream)) { |
|
| 347 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 348 | - echo base64_encode(fread($stream, $length - $read)); |
|
| 349 | - exit(); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - echo base64_encode(fread($stream, 8192)); |
|
| 353 | - $read += 8192; |
|
| 354 | - } |
|
| 355 | - } else { |
|
| 356 | - while (!feof($stream)) { |
|
| 357 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 358 | - echo fread($stream, $length - $read); |
|
| 359 | - exit(); |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - echo fread($stream, 8192); |
|
| 363 | - $read += 8192; |
|
| 364 | - } |
|
| 365 | - } |
|
| 366 | - }); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + $read = 0; |
|
| 343 | + header('Content-Type: '.$mime.''); |
|
| 344 | + if ('base64' === $encode) { |
|
| 345 | + header('Content-Encoding: base64'); |
|
| 346 | + while (!feof($stream)) { |
|
| 347 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 348 | + echo base64_encode(fread($stream, $length - $read)); |
|
| 349 | + exit(); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + echo base64_encode(fread($stream, 8192)); |
|
| 353 | + $read += 8192; |
|
| 354 | + } |
|
| 355 | + } else { |
|
| 356 | + while (!feof($stream)) { |
|
| 357 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 358 | + echo fread($stream, $length - $read); |
|
| 359 | + exit(); |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + echo fread($stream, 8192); |
|
| 363 | + $read += 8192; |
|
| 364 | + } |
|
| 365 | + } |
|
| 366 | + }); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -1502,9 +1502,9 @@ discard block |
||
| 1502 | 1502 | $node->zip($archive); |
| 1503 | 1503 | } catch (\Exception $e) { |
| 1504 | 1504 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
| 1505 | - 'category' => get_class($this), |
|
| 1506 | - 'exception' => $e, |
|
| 1507 | - ]); |
|
| 1505 | + 'category' => get_class($this), |
|
| 1506 | + 'exception' => $e, |
|
| 1507 | + ]); |
|
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| 1510 | 1510 | |
@@ -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 |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 195 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 196 | 196 | if (true === $move) { |
| 197 | 197 | $node = $node->setParent($parent, $conflict); |
| 198 | 198 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $node = $this->_getNode($id, $p); |
| 275 | 275 | if ($node instanceof Collection) { |
| 276 | - return (new Response())->setBody(function () use ($node) { |
|
| 276 | + return (new Response())->setBody(function() use ($node) { |
|
| 277 | 277 | $node->getZip(); |
| 278 | 278 | }); |
| 279 | 279 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | return (new Response()) |
| 294 | 294 | ->setOutputFormat(null) |
| 295 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 295 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 296 | 296 | $mime = $node->getContentType(); |
| 297 | 297 | $stream = $node->get(); |
| 298 | 298 | $name = $node->getName(); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 367 | 367 | { |
| 368 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 368 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 369 | 369 | $node->setReadonly($readonly); |
| 370 | 370 | |
| 371 | 371 | return ['code' => 204]; |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | */ |
| 619 | 619 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
| 620 | 620 | { |
| 621 | - return $this->bulk($id, $p, function ($node) { |
|
| 621 | + return $this->bulk($id, $p, function($node) { |
|
| 622 | 622 | $node->setMetaAttributes($_POST); |
| 623 | 623 | |
| 624 | 624 | return ['code' => 204]; |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | ); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 709 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 710 | 710 | $result = $node->copyTo($parent, $conflict); |
| 711 | 711 | |
| 712 | 712 | return [ |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | ); |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 773 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 774 | 774 | $result = $node->setParent($parent, $conflict); |
| 775 | 775 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 776 | 776 | return [ |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 832 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 833 | 833 | if (null === $at) { |
| 834 | 834 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 835 | 835 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Constructor. |
| 57 | 57 | * |
| 58 | - * @param Notification $notifier |
|
| 58 | + * @param Notifier $notifier |
|
| 59 | 59 | * @param Server $server |
| 60 | 60 | */ |
| 61 | 61 | public function __construct(Notifier $notifier, Server $server, LoggerInterface $logger, TemplateHandler $template) |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param NodeInterface $node |
| 130 | 130 | * @param User $user |
| 131 | 131 | * |
| 132 | - * @return string |
|
| 132 | + * @return boolean |
|
| 133 | 133 | */ |
| 134 | 134 | protected function checkNotify(NodeInterface $node, User $user): bool |
| 135 | 135 | { |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Balloon\App\Notification\NodeMessage; |
| 15 | 15 | use Balloon\App\Notification\Notifier; |
| 16 | 16 | use Balloon\App\Notification\TemplateHandler; |
| 17 | -use Balloon\Async\Mail; |
|
| 18 | 17 | use Balloon\Filesystem\Node\Collection; |
| 19 | 18 | use Balloon\Filesystem\Node\NodeInterface; |
| 20 | 19 | use Balloon\Hook\AbstractHook; |
@@ -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 |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | /** |
| 65 | 65 | * Constructor. |
| 66 | 66 | * |
| 67 | - * @param Notification $notifier |
|
| 67 | + * @param Notifier $notifier |
|
| 68 | 68 | * @param Server $server |
| 69 | 69 | */ |
| 70 | 70 | public function __construct(Notifier $notifier, Server $server, TemplateHandler $template, LoggerInterface $logger, ?Iterable $config = null) |
@@ -19,7 +19,6 @@ |
||
| 19 | 19 | use Balloon\Filesystem\Node\NodeInterface; |
| 20 | 20 | use Balloon\Hook\AbstractHook; |
| 21 | 21 | use Balloon\Server; |
| 22 | -use Balloon\Server\User; |
|
| 23 | 22 | use InvalidArgumentException; |
| 24 | 23 | use MongoDB\BSON\UTCDateTime; |
| 25 | 24 | use Psr\Log\LoggerInterface; |
@@ -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 |
@@ -218,8 +218,6 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * Replace variables. |
| 220 | 220 | * |
| 221 | - * @param string $type |
|
| 222 | - * @param User $user |
|
| 223 | 221 | */ |
| 224 | 222 | protected function decorate(string $template): string |
| 225 | 223 | { |
@@ -229,8 +227,6 @@ discard block |
||
| 229 | 227 | /** |
| 230 | 228 | * Replace variables. |
| 231 | 229 | * |
| 232 | - * @param string $type |
|
| 233 | - * @param User $user |
|
| 234 | 230 | */ |
| 235 | 231 | protected function decorateNode(string $template, NodeInterface $node): string |
| 236 | 232 | { |
@@ -248,7 +244,6 @@ discard block |
||
| 248 | 244 | /** |
| 249 | 245 | * Replace variables. |
| 250 | 246 | * |
| 251 | - * @param string $type |
|
| 252 | 247 | * @param User $user |
| 253 | 248 | */ |
| 254 | 249 | protected function decorateUser(string $template, User $user): string |
@@ -267,9 +262,9 @@ discard block |
||
| 267 | 262 | /** |
| 268 | 263 | * Get array value via string path. |
| 269 | 264 | * |
| 270 | - * @param iterable $arr |
|
| 265 | + * @param iterable $array |
|
| 271 | 266 | * @param string $path |
| 272 | - * @param string $seperator |
|
| 267 | + * @param string $separator |
|
| 273 | 268 | * |
| 274 | 269 | * @return mixed |
| 275 | 270 | */ |
@@ -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 |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | $decorator = $this->decorator; |
| 229 | 229 | |
| 230 | - return preg_replace_callback('/(\{node\.(([a-z]\.*)+)\})/', function ($match) use ($node, $decorator) { |
|
| 230 | + return preg_replace_callback('/(\{node\.(([a-z]\.*)+)\})/', function($match) use ($node, $decorator) { |
|
| 231 | 231 | $key = explode('.', $match[2]); |
| 232 | 232 | $key = array_shift($key); |
| 233 | 233 | $attrs = $decorator->decorate($node, [$key]); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | $role_decorator = $this->role_decorator; |
| 248 | 248 | |
| 249 | - return preg_replace_callback('/(\{user\.(([a-z]\.*)+)\})/', function ($match) use ($user, $role_decorator) { |
|
| 249 | + return preg_replace_callback('/(\{user\.(([a-z]\.*)+)\})/', function($match) use ($user, $role_decorator) { |
|
| 250 | 250 | $key = explode('.', $match[2]); |
| 251 | 251 | $key = array_shift($key); |
| 252 | 252 | $attrs = $role_decorator->decorate($user, [$key]); |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace Balloon\Bootstrap; |
| 13 | 13 | |
| 14 | -use Balloon\App; |
|
| 15 | 14 | use Composer\Autoload\ClassLoader as Composer; |
| 16 | 15 | use ErrorException; |
| 17 | 16 | use Micro\Container\Container; |
@@ -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 | */ |
| 182 | 182 | protected function setErrorHandler(): self |
| 183 | 183 | { |
| 184 | - set_error_handler(function ($severity, $message, $file, $line) { |
|
| 184 | + set_error_handler(function($severity, $message, $file, $line) { |
|
| 185 | 185 | $log = $message.' in '.$file.':'.$line; |
| 186 | 186 | |
| 187 | 187 | if (null === $this->container) { |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | * @param string $attribute |
| 101 | 101 | * @param Closure $decorator |
| 102 | 102 | * |
| 103 | - * @return AttributeDecorator |
|
| 103 | + * @return EventAttributeDecorator |
|
| 104 | 104 | */ |
| 105 | 105 | public function addDecorator(string $attribute, Closure $decorator): self |
| 106 | 106 | { |
@@ -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 |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | use Balloon\Filesystem\Node\File; |
| 15 | 15 | use Balloon\Filesystem\Storage\Adapter\AdapterInterface; |
| 16 | -use Balloon\Filesystem\Storage\Adapter\Gridfs; |
|
| 17 | 16 | use Psr\Log\LoggerInterface; |
| 18 | 17 | |
| 19 | 18 | class Storage |
@@ -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 |
@@ -44,7 +44,6 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Inject hook. |
| 46 | 46 | * |
| 47 | - * @param HookInterface $adapter |
|
| 48 | 47 | * |
| 49 | 48 | * @return Hook |
| 50 | 49 | */ |
@@ -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 |