@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | /** |
| 349 | 349 | * Get real id (reference) |
| 350 | 350 | * |
| 351 | - * @return ObjectId |
|
| 351 | + * @return ObjectId|null |
|
| 352 | 352 | */ |
| 353 | 353 | public function getRealId(): ?ObjectId |
| 354 | 354 | { |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | * |
| 1012 | 1012 | * @param string $name |
| 1013 | 1013 | * @param string $data |
| 1014 | - * @return File |
|
| 1014 | + * @return string |
|
| 1015 | 1015 | */ |
| 1016 | 1016 | public function createFile($name, $data=null): String |
| 1017 | 1017 | { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param Filesystem $fs |
| 73 | 73 | * @return void |
| 74 | 74 | */ |
| 75 | - public function __construct(?BSONDocument $node, Filesystem $fs) |
|
| 75 | + public function __construct(? BSONDocument $node, Filesystem $fs) |
|
| 76 | 76 | { |
| 77 | 77 | parent::__construct($node, $fs); |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->_id = null; |
| 81 | 81 | |
| 82 | 82 | if ($this->_user instanceof User) { |
| 83 | - $this->owner = $this->_user->getId(); |
|
| 83 | + $this->owner = $this->_user->getId(); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param bool $recursion_first |
| 98 | 98 | * @return INode |
| 99 | 99 | */ |
| 100 | - public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode |
|
| 100 | + public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ? string $recursion = null, bool $recursion_first = true) : INode |
|
| 101 | 101 | { |
| 102 | 102 | if ($recursion === null) { |
| 103 | 103 | $recursion_first = true; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param array|string $attribute |
| 197 | 197 | * @return array|string |
| 198 | 198 | */ |
| 199 | - public function getAttribute($attribute=[]) |
|
| 199 | + public function getAttribute($attribute = []) |
|
| 200 | 200 | { |
| 201 | 201 | if (empty($attribute)) { |
| 202 | 202 | $attribute = [ |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param array $filter |
| 243 | 243 | * @return Generator |
| 244 | 244 | */ |
| 245 | - public function getChildNodes(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): Generator |
|
| 245 | + public function getChildNodes(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): Generator |
|
| 246 | 246 | { |
| 247 | 247 | if ($this->_user instanceof User) { |
| 248 | 248 | $this->_user->findNewShares(); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @param array $filter |
| 314 | 314 | * @return Generator |
| 315 | 315 | */ |
| 316 | - public function getChildren(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): array |
|
| 316 | + public function getChildren(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): array |
|
| 317 | 317 | { |
| 318 | 318 | return iterator_to_array($this->getChildNodes($deleted, $filter)); |
| 319 | 319 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * |
| 351 | 351 | * @return ObjectId |
| 352 | 352 | */ |
| 353 | - public function getRealId(): ?ObjectId |
|
| 353 | + public function getRealId(): ? ObjectId |
|
| 354 | 354 | { |
| 355 | 355 | if ($this->shared == true && $this->isReference()) { |
| 356 | 356 | return $this->reference; |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @param array $filter |
| 385 | 385 | * @return INode |
| 386 | 386 | */ |
| 387 | - public function getChild($node, int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): INode |
|
| 387 | + public function getChild($node, int $deleted = INode::DELETED_EXCLUDE, array $filter = []): INode |
|
| 388 | 388 | { |
| 389 | 389 | //if $node is string load the object from the backend based on the current parent (the name |
| 390 | 390 | //is unique per depth, so we can load the object) |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @param int $deleted |
| 454 | 454 | * @return bool |
| 455 | 455 | */ |
| 456 | - protected function doRecursiveAction(string $method, array $params=[], int $deleted=INode::DELETED_EXCLUDE): bool |
|
| 456 | + protected function doRecursiveAction(string $method, array $params = [], int $deleted = INode::DELETED_EXCLUDE): bool |
|
| 457 | 457 | { |
| 458 | 458 | if (!is_callable([$this, $method])) { |
| 459 | 459 | throw new Exception("method $method is not callable in ".__CLASS__); |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @param bool $recursion_first |
| 481 | 481 | * @return bool |
| 482 | 482 | */ |
| 483 | - public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool |
|
| 483 | + public function delete(bool $force = false, ? string $recursion = null, bool $recursion_first = true) : bool |
|
| 484 | 484 | { |
| 485 | 485 | if (!$this->isAllowed('w') && !$this->isReference()) { |
| 486 | 486 | throw new Exception\Forbidden('not allowed to delete node '.$this->name, |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * @param bool $recursion_first |
| 544 | 544 | * @return bool |
| 545 | 545 | */ |
| 546 | - protected function _forceDelete(?string $recursion=null, bool $recursion_first=true): bool |
|
| 546 | + protected function _forceDelete(? string $recursion = null, bool $recursion_first = true) : bool |
|
| 547 | 547 | { |
| 548 | 548 | if (!$this->isReference()) { |
| 549 | 549 | $this->doRecursiveAction('delete', [ |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | * @param array $filter |
| 596 | 596 | * @return bool |
| 597 | 597 | */ |
| 598 | - public function childExists($name, $deleted=INode::DELETED_EXCLUDE, array $filter=[]): bool |
|
| 598 | + public function childExists($name, $deleted = INode::DELETED_EXCLUDE, array $filter = []): bool |
|
| 599 | 599 | { |
| 600 | 600 | $find = [ |
| 601 | 601 | 'parent' => $this->getRealId(), |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | $this->shared = false; |
| 732 | - $this->acl = null; |
|
| 732 | + $this->acl = null; |
|
| 733 | 733 | $action = [ |
| 734 | 734 | '$unset' => [ |
| 735 | 735 | 'shared' => $this->_id |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | * @param arary $files |
| 790 | 790 | * @return array |
| 791 | 791 | */ |
| 792 | - public function getChildrenRecursive(?ObjectId $id=null, ?array &$shares=[], ?array &$files=[]): array |
|
| 792 | + public function getChildrenRecursive(? ObjectId $id = null, ? array &$shares = [], ? array &$files = []) : array |
|
| 793 | 793 | { |
| 794 | 794 | $list = []; |
| 795 | 795 | $result = $this->_db->storage->find([ |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | * @param bool $clone |
| 834 | 834 | * @return Collection |
| 835 | 835 | */ |
| 836 | - public function addDirectory($name, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): Collection |
|
| 836 | + public function addDirectory($name, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): Collection |
|
| 837 | 837 | { |
| 838 | 838 | if (!$this->isAllowed('w')) { |
| 839 | 839 | throw new Exception\Forbidden('not allowed to create new node here', |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | 'shared' => ($this->shared === true ? $this->getRealId() : $this->shared) |
| 881 | 881 | ]; |
| 882 | 882 | |
| 883 | - $save = array_merge($meta, $attributes); |
|
| 883 | + $save = array_merge($meta, $attributes); |
|
| 884 | 884 | |
| 885 | 885 | $result = $this->_db->storage->insertOne($save); |
| 886 | 886 | $save['_id'] = $result->getInsertedId(); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @param bool $clone |
| 914 | 914 | * @return File |
| 915 | 915 | */ |
| 916 | - public function addFile($name, $data=null, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): File |
|
| 916 | + public function addFile($name, $data = null, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): File |
|
| 917 | 917 | { |
| 918 | 918 | if (!$this->isAllowed('w')) { |
| 919 | 919 | throw new Exception\Forbidden('not allowed to create new node here', |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | 'shared' => ($this->shared === true ? $this->getRealId() : $this->shared), |
| 964 | 964 | ]; |
| 965 | 965 | |
| 966 | - $save = array_merge($meta, $attributes); |
|
| 966 | + $save = array_merge($meta, $attributes); |
|
| 967 | 967 | |
| 968 | 968 | $result = $this->_db->storage->insertOne($save); |
| 969 | 969 | $save['_id'] = $result->getInsertedId(); |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | * @param string $data |
| 1014 | 1014 | * @return File |
| 1015 | 1015 | */ |
| 1016 | - public function createFile($name, $data=null): String |
|
| 1016 | + public function createFile($name, $data = null): String |
|
| 1017 | 1017 | { |
| 1018 | 1018 | return $this->addFile($name, $data)->getETag(); |
| 1019 | 1019 | } |