@@ -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': |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | public function preCopyFile( |
| 207 | 207 | File $node, |
| 208 | 208 | Collection $parent, |
| 209 | - int $conflict, |
|
| 209 | + int $conflict, |
|
| 210 | 210 | ?string $recursion, |
| 211 | 211 | bool $recursion_first |
| 212 | 212 | ): void; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | File $node, |
| 228 | 228 | Collection $parent, |
| 229 | 229 | File $new_node, |
| 230 | - int $conflict, |
|
| 230 | + int $conflict, |
|
| 231 | 231 | ?string $recursion, |
| 232 | 232 | bool $recursion_first |
| 233 | 233 | ): 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 |
@@ -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 @@ 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,8 +192,8 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function findRawNode(ObjectId $id): array |
| 194 | 194 | { |
| 195 | - if (isset($this->cache[(string) $id])) { |
|
| 196 | - return $this->cache[(string) $id]->getRawAttributes(); |
|
| 195 | + if (isset($this->cache[(string)$id])) { |
|
| 196 | + return $this->cache[(string)$id]->getRawAttributes(); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | $node = $this->db->storage->findOne(['_id' => $id]); |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function findNodeById($id, ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): NodeInterface |
| 220 | 220 | { |
| 221 | - if (isset($this->cache[(string) $id])) { |
|
| 222 | - return $this->cache[(string) $id]; |
|
| 221 | + if (isset($this->cache[(string)$id])) { |
|
| 222 | + return $this->cache[(string)$id]; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (!is_string($id) && !($id instanceof ObjectId)) { |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | throw new Exception\Conflict('node is not available anymore'); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $this->cache[(string) $node['_id']] = $instance; |
|
| 600 | + $this->cache[(string)$node['_id']] = $instance; |
|
| 601 | 601 | |
| 602 | 602 | return $instance; |
| 603 | 603 | } |
@@ -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 | * |
@@ -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 | } |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use Balloon\Filesystem\Storage; |
| 19 | 19 | use Balloon\Hook; |
| 20 | 20 | use Balloon\Mime; |
| 21 | -use Balloon\Server\User; |
|
| 22 | 21 | use MongoDB\BSON\UTCDateTime; |
| 23 | 22 | use Psr\Log\LoggerInterface; |
| 24 | 23 | |
@@ -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( |
@@ -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 |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $wrote = fwrite($chunkgroup_handler, $data); |
| 311 | 311 | $tmp_size += $wrote; |
| 312 | 312 | |
| 313 | - if ($tmp_size > (int) $this->server->getMaxFileSize()) { |
|
| 313 | + if ($tmp_size > (int)$this->server->getMaxFileSize()) { |
|
| 314 | 314 | fclose($input_handler); |
| 315 | 315 | fclose($chunkgroup_handler); |
| 316 | 316 | unlink($file); |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | $result = $collection->addFile($name, $content, $attributes)->getId(); |
| 515 | 515 | |
| 516 | - return (new Response())->setCode(201)->setBody((string) $result); |
|
| 516 | + return (new Response())->setCode(201)->setBody((string)$result); |
|
| 517 | 517 | } |
| 518 | 518 | } catch (ForbiddenException $e) { |
| 519 | 519 | throw new Exception\Conflict( |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $result = $parent->addFile($name, $content, $attributes)->getId(); |
| 540 | 540 | |
| 541 | - return (new Response())->setCode(201)->setBody((string) $result); |
|
| 541 | + return (new Response())->setCode(201)->setBody((string)$result); |
|
| 542 | 542 | } catch (Exception\NotFound $e) { |
| 543 | 543 | throw new Exception('parent collection '.$parent_path.' was not found'); |
| 544 | 544 | } |
@@ -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 |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $result = $this->_getNode($id, $p, null, false, false, $deleted); |
| 140 | 140 | |
| 141 | 141 | $response = (new Response()) |
| 142 | - ->setHeader('Content-Length', (string) $result->getSize()) |
|
| 142 | + ->setHeader('Content-Length', (string)$result->getSize()) |
|
| 143 | 143 | ->setHeader('Content-Type', $result->getContentType()) |
| 144 | 144 | ->setCode(200); |
| 145 | 145 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 211 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 212 | 212 | if (true === $move) { |
| 213 | 213 | $node = $node->setParent($parent, $conflict); |
| 214 | 214 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $node = $this->_getNode($id, $p); |
| 291 | 291 | if ($node instanceof Collection) { |
| 292 | - return (new Response())->setBody(function () use ($node) { |
|
| 292 | + return (new Response())->setBody(function() use ($node) { |
|
| 293 | 293 | $node->getZip(); |
| 294 | 294 | }); |
| 295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $response->setHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($name)); |
| 301 | 301 | $response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
| 302 | 302 | $response->setHeader('Content-Type', 'application/octet-stream'); |
| 303 | - $response->setHeader('Content-Length', (string) $node->getSize()); |
|
| 303 | + $response->setHeader('Content-Length', (string)$node->getSize()); |
|
| 304 | 304 | $response->setHeader('Content-Transfer-Encoding', 'binary'); |
| 305 | 305 | } else { |
| 306 | 306 | $response->setHeader('Content-Disposition', 'inline; filename*=UTF-8\'\''.rawurlencode($name)); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | return (new Response()) |
| 310 | 310 | ->setOutputFormat(null) |
| 311 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 311 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 312 | 312 | $mime = $node->getContentType(); |
| 313 | 313 | $stream = $node->get(); |
| 314 | 314 | $name = $node->getName(); |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 383 | 383 | { |
| 384 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 384 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 385 | 385 | $node->setReadonly($readonly); |
| 386 | 386 | |
| 387 | 387 | return ['code' => 204]; |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function postMetaAttributes(array $attributes, ?string $id = null, ?string $p = null): Response |
| 627 | 627 | { |
| 628 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
| 628 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
| 629 | 629 | $node->setMetaAttributes($attributes); |
| 630 | 630 | |
| 631 | 631 | return ['code' => 204]; |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | ); |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 716 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 717 | 717 | $result = $node->copyTo($parent, $conflict); |
| 718 | 718 | |
| 719 | 719 | return [ |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | ); |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 780 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 781 | 781 | $result = $node->setParent($parent, $conflict); |
| 782 | 782 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 783 | 783 | return [ |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 839 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 840 | 840 | if (null === $at) { |
| 841 | 841 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 842 | 842 | } else { |
@@ -1233,9 +1233,9 @@ discard block |
||
| 1233 | 1233 | $body = []; |
| 1234 | 1234 | foreach ($this->_getNodes($id, $p) as $node) { |
| 1235 | 1235 | try { |
| 1236 | - $body[(string) $node->getId()] = $action->call($this, $node); |
|
| 1236 | + $body[(string)$node->getId()] = $action->call($this, $node); |
|
| 1237 | 1237 | } catch (\Exception $e) { |
| 1238 | - $body[(string) $node->getId()] = [ |
|
| 1238 | + $body[(string)$node->getId()] = [ |
|
| 1239 | 1239 | 'code' => 400, |
| 1240 | 1240 | 'data' => [ |
| 1241 | 1241 | 'error' => get_class($e), |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | foreach ($attributes as $attribute => $value) { |
| 1392 | 1392 | switch ($attribute) { |
| 1393 | 1393 | case 'filter': |
| 1394 | - $attributes['filter'] = json_encode((array) $attributes['filter']); |
|
| 1394 | + $attributes['filter'] = json_encode((array)$attributes['filter']); |
|
| 1395 | 1395 | |
| 1396 | 1396 | break; |
| 1397 | 1397 | case 'destroy': |
@@ -1406,14 +1406,14 @@ discard block |
||
| 1406 | 1406 | if (!Helper::isValidTimestamp($value)) { |
| 1407 | 1407 | throw new Exception\InvalidArgument($attribute.' Changed timestamp must be valid unix timestamp'); |
| 1408 | 1408 | } |
| 1409 | - if ((int) $value > time()) { |
|
| 1409 | + if ((int)$value > time()) { |
|
| 1410 | 1410 | throw new Exception\InvalidArgument($attribute.' timestamp can not be set greater than the server time'); |
| 1411 | 1411 | } |
| 1412 | 1412 | $attributes[$attribute] = new UTCDateTime($value.'000'); |
| 1413 | 1413 | |
| 1414 | 1414 | break; |
| 1415 | 1415 | case 'readonly': |
| 1416 | - $attributes['readonly'] = (bool) $attributes['readonly']; |
|
| 1416 | + $attributes['readonly'] = (bool)$attributes['readonly']; |
|
| 1417 | 1417 | |
| 1418 | 1418 | break; |
| 1419 | 1419 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | /** |
| 214 | 214 | * Get es client. |
| 215 | 215 | * |
| 216 | - * @return Elasticsearch |
|
| 216 | + * @return Client |
|
| 217 | 217 | */ |
| 218 | 218 | public function getEsClient(): Client |
| 219 | 219 | { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * Search. |
| 231 | 231 | * |
| 232 | 232 | * @param array $query |
| 233 | - * @param array $share |
|
| 233 | + * @param array $shares |
|
| 234 | 234 | * |
| 235 | 235 | * @return array |
| 236 | 236 | */ |
@@ -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 |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | foreach ($config as $option => $value) { |
| 94 | 94 | switch ($option) { |
| 95 | 95 | case 'server': |
| 96 | - $this->es_server = (array) $value; |
|
| 96 | + $this->es_server = (array)$value; |
|
| 97 | 97 | |
| 98 | 98 | break; |
| 99 | 99 | case 'index': |
| 100 | - $this->es_index = (string) $value; |
|
| 100 | + $this->es_index = (string)$value; |
|
| 101 | 101 | |
| 102 | 102 | break; |
| 103 | 103 | default: |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ], |
| 148 | 148 | ]); |
| 149 | 149 | |
| 150 | - $user = (string) $this->user->getId(); |
|
| 150 | + $user = (string)$this->user->getId(); |
|
| 151 | 151 | foreach ($result['hits']['hits'] as $node) { |
| 152 | 152 | $id = false; |
| 153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $_node = $this->fs->findNodeById($id); |
| 159 | 159 | if ($_node->isDeleted() && (1 === $deleted || 2 === $deleted) |
| 160 | 160 | || !$_node->isDeleted() && (0 === $deleted || 2 === $deleted)) { |
| 161 | - if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string) $_node->getId()])) { |
|
| 162 | - $list[(string) $_node->getId()] = $_node; |
|
| 161 | + if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string)$_node->getId()])) { |
|
| 162 | + $list[(string)$_node->getId()] = $_node; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | } catch (\Exception $e) { |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | $bool = $query['body']['query']; |
| 240 | 240 | |
| 241 | 241 | $filter1 = []; |
| 242 | - $filter1['bool']['should'][]['term']['owner'] = (string) $this->user->getId(); |
|
| 243 | - $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string) $this->user->getId(); |
|
| 242 | + $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId(); |
|
| 243 | + $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string)$this->user->getId(); |
|
| 244 | 244 | |
| 245 | 245 | $share_filter = [ |
| 246 | 246 | 'bool' => [ |