@@ -173,6 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Filesystem factory. |
| 175 | 175 | * |
| 176 | + * @param User $user |
|
| 176 | 177 | * @return Filesystem |
| 177 | 178 | */ |
| 178 | 179 | public function getFilesystem(?User $user = null): Filesystem |
@@ -376,7 +377,7 @@ discard block |
||
| 376 | 377 | * |
| 377 | 378 | * @param string $id |
| 378 | 379 | * |
| 379 | - * @return User |
|
| 380 | + * @return Group |
|
| 380 | 381 | */ |
| 381 | 382 | public function getGroupById(ObjectId $id): Group |
| 382 | 383 | { |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | public function getGroupByName(string $name): Group |
| 544 | 544 | { |
| 545 | 545 | $attributes = $this->db->group->findOne([ |
| 546 | - 'name' => $name, |
|
| 546 | + 'name' => $name, |
|
| 547 | 547 | ]); |
| 548 | 548 | |
| 549 | 549 | if (null === $attributes) { |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | public function getGroupById(ObjectId $id): Group |
| 564 | 564 | { |
| 565 | 565 | $attributes = $this->db->group->findOne([ |
| 566 | - '_id' => $id, |
|
| 566 | + '_id' => $id, |
|
| 567 | 567 | ]); |
| 568 | 568 | |
| 569 | 569 | if (null === $attributes) { |
@@ -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 |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | switch ($name) { |
| 144 | 144 | case 'temp_dir': |
| 145 | 145 | case 'password_policy': |
| 146 | - $this->{$name} = (string) $value; |
|
| 146 | + $this->{$name} = (string)$value; |
|
| 147 | 147 | |
| 148 | 148 | break; |
| 149 | 149 | case 'max_file_version': |
| 150 | 150 | case 'max_file_size': |
| 151 | 151 | case 'password_hash': |
| 152 | - $this->{$name} = (int) $value; |
|
| 152 | + $this->{$name} = (int)$value; |
|
| 153 | 153 | |
| 154 | 154 | break; |
| 155 | 155 | default: |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | break; |
| 320 | 320 | case 'admin': |
| 321 | - $value = (bool) $value; |
|
| 321 | + $value = (bool)$value; |
|
| 322 | 322 | |
| 323 | 323 | break; |
| 324 | 324 | case 'namespace': |
@@ -424,8 +424,8 @@ |
||
| 424 | 424 | ]; |
| 425 | 425 | |
| 426 | 426 | $node->getFilesystem()->getDatabase()->delta->updateMany([ |
| 427 | - 'node' => [ |
|
| 428 | - '$in' => $toset, |
|
| 427 | + 'node' => [ |
|
| 428 | + '$in' => $toset, |
|
| 429 | 429 | ], |
| 430 | 430 | ], $action); |
| 431 | 431 | |
@@ -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 |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function preCopyFile( |
| 117 | 117 | File $node, |
| 118 | 118 | Collection $parent, |
| 119 | - int $conflict, |
|
| 119 | + int $conflict, |
|
| 120 | 120 | ?string $recursion, |
| 121 | 121 | bool $recursion_first |
| 122 | 122 | ): void { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | File $node, |
| 130 | 130 | Collection $parent, |
| 131 | 131 | File $new_node, |
| 132 | - int $conflict, |
|
| 132 | + int $conflict, |
|
| 133 | 133 | ?string $recursion, |
| 134 | 134 | bool $recursion_first |
| 135 | 135 | ): void { |
@@ -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 |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $this->logger->info('found first time username ['.$identity->getIdentifier().'], auto-create user in mongodb user collection', [ |
| 94 | - 'category' => get_class($this), |
|
| 94 | + 'category' => get_class($this), |
|
| 95 | 95 | ]); |
| 96 | 96 | |
| 97 | 97 | $attributes = [ |
@@ -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,15 +110,15 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | switch ($value['type']) { |
| 112 | 112 | case 'string': |
| 113 | - $attributes[$attr] = (string) $value['value']; |
|
| 113 | + $attributes[$attr] = (string)$value['value']; |
|
| 114 | 114 | |
| 115 | 115 | break; |
| 116 | 116 | case 'int': |
| 117 | - $attributes[$attr] = (int) $value['value']; |
|
| 117 | + $attributes[$attr] = (int)$value['value']; |
|
| 118 | 118 | |
| 119 | 119 | break; |
| 120 | 120 | case 'bool': |
| 121 | - $attributes[$attr] = (bool) $value['value']; |
|
| 121 | + $attributes[$attr] = (bool)$value['value']; |
|
| 122 | 122 | |
| 123 | 123 | break; |
| 124 | 124 | case 'binary': |
@@ -85,6 +85,6 @@ |
||
| 85 | 85 | protected function getTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return __DIR__.DIRECTORY_SEPARATOR.'assets' |
| 88 | - .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
| 88 | + .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
| 89 | 89 | } |
| 90 | 90 | } |
@@ -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 |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace Balloon\App\Preview; |
| 14 | 14 | |
| 15 | -use Balloon\Exception; |
|
| 16 | 15 | use Balloon\Filesystem\Node\File; |
| 17 | 16 | use Balloon\Hook\AbstractHook; |
| 18 | 17 | use MongoDB\GridFS\Exception\FileNotFoundException; |
@@ -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 |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * |
| 292 | 292 | * @param array $id |
| 293 | 293 | * @param string $class Force check node type |
| 294 | - * @param bool $deleted |
|
| 294 | + * @param integer $deleted |
|
| 295 | 295 | * |
| 296 | 296 | * @return Generator |
| 297 | 297 | */ |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param string $class Force set node type |
| 412 | 412 | * @param bool $multiple Allow $id to be an array |
| 413 | 413 | * @param bool $allow_root Allow instance of root collection |
| 414 | - * @param bool $deleted How to handle deleted node |
|
| 414 | + * @param integer $deleted How to handle deleted node |
|
| 415 | 415 | * |
| 416 | 416 | * @return NodeInterface |
| 417 | 417 | */ |
@@ -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 |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | * @param string $path |
| 695 | 695 | * @param bool $new |
| 696 | 696 | * |
| 697 | - * @return bool |
|
| 697 | + * @return string |
|
| 698 | 698 | */ |
| 699 | 699 | protected function verifyFile(?string $path, bool $new = false): string |
| 700 | 700 | { |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | /** |
| 828 | 828 | * Finalize put request. |
| 829 | 829 | * |
| 830 | - * @param resource|string $file |
|
| 830 | + * @param string|null $file |
|
| 831 | 831 | * @param bool $new |
| 832 | 832 | * @param array $attributes |
| 833 | 833 | * |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Balloon\Helper; |
| 21 | 21 | use Balloon\Hook; |
| 22 | 22 | use Balloon\Mime; |
| 23 | -use Balloon\Server\User; |
|
| 24 | 23 | use MongoDB\BSON\UTCDateTime; |
| 25 | 24 | use Psr\Log\LoggerInterface; |
| 26 | 25 | |
@@ -589,7 +589,7 @@ |
||
| 589 | 589 | ]); |
| 590 | 590 | |
| 591 | 591 | $this->addVersion($attributes) |
| 592 | - ->postPutFile($file, $new, $attributes); |
|
| 592 | + ->postPutFile($file, $new, $attributes); |
|
| 593 | 593 | |
| 594 | 594 | return $this->version; |
| 595 | 595 | } |
@@ -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 |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | * @param array |
| 46 | 46 | **/ |
| 47 | 47 | protected $temp_files = [ |
| 48 | - '/^\._(.*)$/', // OS/X resource forks |
|
| 49 | - '/^.DS_Store$/', // OS/X custom folder settings |
|
| 48 | + '/^\._(.*)$/', // OS/X resource forks |
|
| 49 | + '/^.DS_Store$/', // OS/X custom folder settings |
|
| 50 | 50 | '/^desktop.ini$/', // Windows custom folder settings |
| 51 | - '/^Thumbs.db$/', // Windows thumbnail cache |
|
| 52 | - '/^.(.*).swpx$/', // ViM temporary files |
|
| 53 | - '/^.(.*).swx$/', // ViM temporary files |
|
| 54 | - '/^.(.*).swp$/', // ViM temporary files |
|
| 55 | - '/^\.dat(.*)$/', // Smultron seems to create these |
|
| 51 | + '/^Thumbs.db$/', // Windows thumbnail cache |
|
| 52 | + '/^.(.*).swpx$/', // ViM temporary files |
|
| 53 | + '/^.(.*).swx$/', // ViM temporary files |
|
| 54 | + '/^.(.*).swp$/', // ViM temporary files |
|
| 55 | + '/^\.dat(.*)$/', // Smultron seems to create these |
|
| 56 | 56 | '/^~lock.(.*)#$/', // Windows 7 lockfiles |
| 57 | 57 | ]; |
| 58 | 58 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $filtered = []; |
| 198 | 198 | |
| 199 | 199 | foreach ($history as $version) { |
| 200 | - $v = (array) $version; |
|
| 200 | + $v = (array)$version; |
|
| 201 | 201 | |
| 202 | 202 | $v['user'] = $this->_fs->getServer()->getUserById($version['user'])->getUsername(); |
| 203 | 203 | $v['changed'] = Helper::DateTimeToUnix($version['changed']); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | $this->hash = $new_hash; |
| 557 | - $max = (int) (string) $this->_fs->getServer()->getMaxFileVersion(); |
|
| 557 | + $max = (int)(string)$this->_fs->getServer()->getMaxFileVersion(); |
|
| 558 | 558 | if (count($this->history) >= $max) { |
| 559 | 559 | $del = key($this->history); |
| 560 | 560 | $this->_logger->debug('history limit ['.$max.'] reached, remove oldest version ['.$del.'] from file ['.$this->_id.']', [ |
@@ -648,8 +648,8 @@ discard block |
||
| 648 | 648 | { |
| 649 | 649 | assert(16 === strlen($data)); |
| 650 | 650 | |
| 651 | - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 |
|
| 652 | - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 |
|
| 651 | + $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100 |
|
| 652 | + $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10 |
|
| 653 | 653 | |
| 654 | 654 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); |
| 655 | 655 | } |
@@ -752,11 +752,11 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | $tmp_file = $tmp.DIRECTORY_SEPARATOR.$this->guidv4(openssl_random_pseudo_bytes(16)); |
| 754 | 754 | $stream = fopen($tmp_file, 'w+'); |
| 755 | - $size = stream_copy_to_stream($file, $stream, ((int) $this->_fs->getServer()->getMaxFileSize() + 1)); |
|
| 755 | + $size = stream_copy_to_stream($file, $stream, ((int)$this->_fs->getServer()->getMaxFileSize() + 1)); |
|
| 756 | 756 | rewind($stream); |
| 757 | 757 | fclose($file); |
| 758 | 758 | |
| 759 | - if ($size > (int) $this->_fs->getServer()->getMaxFileSize()) { |
|
| 759 | + if ($size > (int)$this->_fs->getServer()->getMaxFileSize()) { |
|
| 760 | 760 | unlink($tmp_file); |
| 761 | 761 | |
| 762 | 762 | throw new Exception\InsufficientStorage( |
@@ -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 |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $wrote = fwrite($chunkgroup_handler, $data); |
| 294 | 294 | $tmp_size += $wrote; |
| 295 | 295 | |
| 296 | - if ($tmp_size > (int) $this->server->getMaxFileSize()) { |
|
| 296 | + if ($tmp_size > (int)$this->server->getMaxFileSize()) { |
|
| 297 | 297 | fclose($input_handler); |
| 298 | 298 | fclose($chunkgroup_handler); |
| 299 | 299 | unlink($file); |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | $name = Helper::filter($name); |
| 498 | 498 | $result = $collection->addFile($name, $content, $attributes)->getId(); |
| 499 | 499 | |
| 500 | - return (new Response())->setCode(201)->setBody((string) $result); |
|
| 500 | + return (new Response())->setCode(201)->setBody((string)$result); |
|
| 501 | 501 | } |
| 502 | 502 | } catch (ForbiddenException $e) { |
| 503 | 503 | throw new Exception\Conflict( |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $result = $parent->addFile($name, $content, $attributes)->getId(); |
| 525 | 525 | |
| 526 | - return (new Response())->setCode(201)->setBody((string) $result); |
|
| 526 | + return (new Response())->setCode(201)->setBody((string)$result); |
|
| 527 | 527 | } catch (Exception\NotFound $e) { |
| 528 | 528 | throw new Exception('parent collection '.$parent_path.' was not found'); |
| 529 | 529 | } |