@@ -79,7 +79,6 @@ |
||
| 79 | 79 | /** |
| 80 | 80 | * Constructor. |
| 81 | 81 | * |
| 82 | - * @param Database $db |
|
| 83 | 82 | * @param LoggerInterface $logger |
| 84 | 83 | */ |
| 85 | 84 | public function __construct(SocketFactory $factory, LoggerInterface $logger, ?Iterable $config = 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 |
@@ -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; |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * @param ObjectId $session_id |
| 149 | 149 | * @param string $access_token |
| 150 | 150 | * |
| 151 | - * @return Session |
|
| 151 | + * @return Session|null |
|
| 152 | 152 | */ |
| 153 | 153 | public static function getByAccessToken(Server $server, ObjectId $session_id, string $access_token): self |
| 154 | 154 | { |
@@ -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 |
@@ -35,7 +35,6 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * Constructor. |
| 37 | 37 | * |
| 38 | - * @param App $app |
|
| 39 | 38 | * @param Server $server |
| 40 | 39 | */ |
| 41 | 40 | public function __construct(PreviewCreator $preview, Server $server) |
@@ -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 |
@@ -31,8 +31,6 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Constructor. |
| 33 | 33 | * |
| 34 | - * @param Router $router |
|
| 35 | - * @param Hook $hook |
|
| 36 | 34 | */ |
| 37 | 35 | public function __construct(Database $db, LoggerInterface $logger, Converter $converter) |
| 38 | 36 | { |
@@ -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 |
@@ -32,8 +32,7 @@ |
||
| 32 | 32 | * Create result. |
| 33 | 33 | * |
| 34 | 34 | * @param string $path |
| 35 | - * @param resource $stream |
|
| 36 | - * @param null|mixed $resource |
|
| 35 | + * @param resource $resource |
|
| 37 | 36 | */ |
| 38 | 37 | public function __construct(string $path, $resource = null) |
| 39 | 38 | { |
@@ -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 |
@@ -29,7 +29,6 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * Delete file. |
| 31 | 31 | * |
| 32 | - * @param string $id |
|
| 33 | 32 | * @param array $attributes |
| 34 | 33 | * |
| 35 | 34 | * @return bool |
@@ -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 | * |
@@ -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 |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | * @param array |
| 45 | 45 | **/ |
| 46 | 46 | protected $temp_files = [ |
| 47 | - '/^\._(.*)$/', // OS/X resource forks |
|
| 48 | - '/^.DS_Store$/', // OS/X custom folder settings |
|
| 47 | + '/^\._(.*)$/', // OS/X resource forks |
|
| 48 | + '/^.DS_Store$/', // OS/X custom folder settings |
|
| 49 | 49 | '/^desktop.ini$/', // Windows custom folder settings |
| 50 | - '/^Thumbs.db$/', // Windows thumbnail cache |
|
| 51 | - '/^.(.*).swpx$/', // ViM temporary files |
|
| 52 | - '/^.(.*).swx$/', // ViM temporary files |
|
| 53 | - '/^.(.*).swp$/', // ViM temporary files |
|
| 54 | - '/^\.dat(.*)$/', // Smultron seems to create these |
|
| 50 | + '/^Thumbs.db$/', // Windows thumbnail cache |
|
| 51 | + '/^.(.*).swpx$/', // ViM temporary files |
|
| 52 | + '/^.(.*).swx$/', // ViM temporary files |
|
| 53 | + '/^.(.*).swp$/', // ViM temporary files |
|
| 54 | + '/^\.dat(.*)$/', // Smultron seems to create these |
|
| 55 | 55 | '/^~lock.(.*)#$/', // Windows 7 lockfiles |
| 56 | 56 | ]; |
| 57 | 57 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | $this->hash = $new_hash; |
| 546 | - $max = (int) (string) $this->_fs->getServer()->getMaxFileVersion(); |
|
| 546 | + $max = (int)(string)$this->_fs->getServer()->getMaxFileVersion(); |
|
| 547 | 547 | if (count($this->history) >= $max) { |
| 548 | 548 | $del = key($this->history); |
| 549 | 549 | $this->_logger->debug('history limit ['.$max.'] reached, remove oldest version ['.$del.'] from file ['.$this->_id.']', [ |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | assert(16 === strlen($data)); |
| 639 | 639 | |
| 640 | - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 |
|
| 641 | - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 |
|
| 640 | + $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100 |
|
| 641 | + $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10 |
|
| 642 | 642 | |
| 643 | 643 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); |
| 644 | 644 | } |
@@ -741,11 +741,11 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | $tmp_file = $tmp.DIRECTORY_SEPARATOR.$this->guidv4(openssl_random_pseudo_bytes(16)); |
| 743 | 743 | $stream = fopen($tmp_file, 'w+'); |
| 744 | - $size = stream_copy_to_stream($file, $stream, ((int) $this->_fs->getServer()->getMaxFileSize() + 1)); |
|
| 744 | + $size = stream_copy_to_stream($file, $stream, ((int)$this->_fs->getServer()->getMaxFileSize() + 1)); |
|
| 745 | 745 | rewind($stream); |
| 746 | 746 | fclose($file); |
| 747 | 747 | |
| 748 | - if ($size > (int) $this->_fs->getServer()->getMaxFileSize()) { |
|
| 748 | + if ($size > (int)$this->_fs->getServer()->getMaxFileSize()) { |
|
| 749 | 749 | unlink($tmp_file); |
| 750 | 750 | |
| 751 | 751 | throw new Exception\InsufficientStorage( |
@@ -108,14 +108,13 @@ |
||
| 108 | 108 | * |
| 109 | 109 | * @param bool $reference |
| 110 | 110 | * |
| 111 | - * @return ObjectId |
|
| 111 | + * @return ObjectId|null |
|
| 112 | 112 | */ |
| 113 | 113 | public function getShareId(bool $reference = false): ?ObjectId; |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | 116 | * Get share node. |
| 117 | 117 | * |
| 118 | - * @param bool $reference |
|
| 119 | 118 | * |
| 120 | 119 | * @return Collection |
| 121 | 120 | */ |
@@ -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 |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | /** |
| 76 | 76 | * Constructor. |
| 77 | 77 | * |
| 78 | - * @param Elasticsarch $es |
|
| 78 | + * @param Elasticsearch $es |
|
| 79 | 79 | * @param Storage $storage |
| 80 | 80 | * @param Server $server |
| 81 | 81 | * @param NodeAttributeDecorator $decorator |
@@ -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: |
@@ -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 | } |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | $content = base64_encode(stream_get_contents($node->get())); |
| 354 | 354 | |
| 355 | 355 | $metadata = $meta['metadata']; |
| 356 | - array_walk_recursive($metadata, function (&$value) { $value = (string) $value; }); |
|
| 356 | + array_walk_recursive($metadata, function(&$value) { $value = (string)$value; }); |
|
| 357 | 357 | |
| 358 | 358 | $params = [ |
| 359 | 359 | 'index' => $this->es->getIndex(), |
| 360 | - 'id' => (string) new ObjectId(), |
|
| 360 | + 'id' => (string)new ObjectId(), |
|
| 361 | 361 | 'type' => 'fs', |
| 362 | 362 | 'body' => [ |
| 363 | 363 | 'metadata' => $metadata, |