@@ -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 |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param bool $force |
223 | 223 | * @return void |
224 | 224 | */ |
225 | - public function __construct(?BSONDocument $node, Filesystem $fs, bool $force=false) |
|
225 | + public function __construct(?BSONDocument $node, Filesystem $fs, bool $force = false) |
|
226 | 226 | { |
227 | 227 | $this->_fs = $fs; |
228 | 228 | $this->_db = $fs->getDatabase(); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return mixed |
272 | 272 | */ |
273 | - public function __call(string $attribute, array $params=[]) |
|
273 | + public function __call(string $attribute, array $params = []) |
|
274 | 274 | { |
275 | 275 | $prefix = 'get'; |
276 | 276 | $attr = strtolower(substr($attribute, 3)); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @param int $conflict |
316 | 316 | * @return INode |
317 | 317 | */ |
318 | - public function setParent(Collection $parent, int $conflict=INode::CONFLICT_NOACTION): INode |
|
318 | + public function setParent(Collection $parent, int $conflict = INode::CONFLICT_NOACTION): INode |
|
319 | 319 | { |
320 | 320 | if ($this->parent === $parent->getId()) { |
321 | 321 | throw new Exception\Conflict('source node '.$this->name.' is already in the requested parent folder', |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @param bool $recursion_first |
391 | 391 | * @return INode |
392 | 392 | */ |
393 | - abstract public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode; |
|
393 | + abstract public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode; |
|
394 | 394 | |
395 | 395 | |
396 | 396 | /** |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param bool $reference |
400 | 400 | * @return ObjectId |
401 | 401 | */ |
402 | - public function getShareId(bool $reference=false): ?ObjectId |
|
402 | + public function getShareId(bool $reference = false): ?ObjectId |
|
403 | 403 | { |
404 | 404 | if ($this->isReference() && $reference === true) { |
405 | 405 | return $this->_id; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * @param string $privilege |
596 | 596 | * @return bool |
597 | 597 | */ |
598 | - public function isAllowed(string $privilege='r'): bool |
|
598 | + public function isAllowed(string $privilege = 'r'): bool |
|
599 | 599 | { |
600 | 600 | $acl = null; |
601 | 601 | $share = null; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $clean[] = 'meta'; |
790 | 790 | } |
791 | 791 | |
792 | - $attribute = $clean; |
|
792 | + $attribute = $clean; |
|
793 | 793 | |
794 | 794 | try { |
795 | 795 | $sharenode = $this->getShareNode(); |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | * @param string $name |
920 | 920 | * @return string |
921 | 921 | */ |
922 | - protected function _getDuplicateName(?string $name=null): string |
|
922 | + protected function _getDuplicateName(?string $name = null) : string |
|
923 | 923 | { |
924 | 924 | if ($name === null) { |
925 | 925 | $name = $this->name; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | if ($this instanceof Collection) { |
929 | 929 | return $name.' ('.substr(uniqid('', true), -4).')'; |
930 | 930 | } else { |
931 | - $ext = substr(strrchr($name, '.'), 1); |
|
931 | + $ext = substr(strrchr($name, '.'), 1); |
|
932 | 932 | |
933 | 933 | if ($ext === false) { |
934 | 934 | return $name.' ('.substr(uniqid('', true), -4).')'; |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | * @param bool $recursion_first |
949 | 949 | * @return bool |
950 | 950 | */ |
951 | - public function undelete(int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): bool |
|
951 | + public function undelete(int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : bool |
|
952 | 952 | { |
953 | 953 | if (!$this->isAllowed('w')) { |
954 | 954 | throw new Exception\Forbidden('not allowed to restore node '.$this->name, |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | $recursion_first = false; |
989 | 989 | } |
990 | 990 | |
991 | - $this->deleted = false; |
|
991 | + $this->deleted = false; |
|
992 | 992 | |
993 | 993 | if ($this instanceof File) { |
994 | 994 | $current = $this->version; |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | 'deleted', |
1017 | 1017 | ], [], $recursion, $recursion_first); |
1018 | 1018 | |
1019 | - if($this->isReference()) { |
|
1019 | + if ($this->isReference()) { |
|
1020 | 1020 | return true; |
1021 | 1021 | } |
1022 | 1022 | |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | * |
1147 | 1147 | * @return ObjectId|string |
1148 | 1148 | */ |
1149 | - public function getId(bool $string=false) |
|
1149 | + public function getId(bool $string = false) |
|
1150 | 1150 | { |
1151 | 1151 | if ($string === true) { |
1152 | 1152 | return (string)$this->_id; |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @param array $parents |
1197 | 1197 | * @return array |
1198 | 1198 | */ |
1199 | - public function getParents(?INode $node=null, array $parents=[]): array |
|
1199 | + public function getParents(?INode $node = null, array $parents = []) : array |
|
1200 | 1200 | { |
1201 | 1201 | if ($node === null) { |
1202 | 1202 | $node = $this; |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | * @param int $depth |
1264 | 1264 | * @return bool |
1265 | 1265 | */ |
1266 | - public function zip(ZipStream $archive, bool $self=true, ?INode $parent=null, string $path='', int $depth=0): bool |
|
1266 | + public function zip(ZipStream $archive, bool $self = true, ?INode $parent = null, string $path = '', int $depth = 0) : bool |
|
1267 | 1267 | { |
1268 | 1268 | if ($parent === null) { |
1269 | 1269 | $parent = $this; |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | * @param mixed $value |
1326 | 1326 | * @return INode |
1327 | 1327 | */ |
1328 | - public function setMetaAttribute($attributes, $value=null): INode |
|
1328 | + public function setMetaAttribute($attributes, $value = null): INode |
|
1329 | 1329 | { |
1330 | 1330 | $this->meta = self::validateMetaAttribute($attributes, $value, $this->meta); |
1331 | 1331 | $this->save('meta'); |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | * @param array $set |
1342 | 1342 | * @return array |
1343 | 1343 | */ |
1344 | - public static function validateMetaAttribute($attributes, $value=null, array $set=[]): array |
|
1344 | + public static function validateMetaAttribute($attributes, $value = null, array $set = []): array |
|
1345 | 1345 | { |
1346 | 1346 | if (is_string($attributes)) { |
1347 | 1347 | $attributes = [ |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | * @param string|array $attribute Specify attributes to return |
1373 | 1373 | * @return string|array |
1374 | 1374 | */ |
1375 | - public function getMetaAttribute($attribute=[]) |
|
1375 | + public function getMetaAttribute($attribute = []) |
|
1376 | 1376 | { |
1377 | 1377 | if (is_string($attribute)) { |
1378 | 1378 | if (isset($this->meta[$attribute])) { |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | * @param bool $readonly |
1393 | 1393 | * @return bool |
1394 | 1394 | */ |
1395 | - public function setReadonly(bool $readonly=true): bool |
|
1395 | + public function setReadonly(bool $readonly = true): bool |
|
1396 | 1396 | { |
1397 | 1397 | $this->readonly = $readonly; |
1398 | 1398 | return $this->save('readonly'); |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | * @param UTCDateTime $ts |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public function setDestroyable(?UTCDateTime $ts): bool |
|
1408 | + public function setDestroyable(?UTCDateTime $ts) : bool |
|
1409 | 1409 | { |
1410 | 1410 | $this->destroy = $ts; |
1411 | 1411 | |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | * @param string $recursion |
1429 | 1429 | * @return bool |
1430 | 1430 | */ |
1431 | - abstract public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool; |
|
1431 | + abstract public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool; |
|
1432 | 1432 | |
1433 | 1433 | |
1434 | 1434 | /** |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | * @param bool $recursion_first |
1499 | 1499 | * @return bool |
1500 | 1500 | */ |
1501 | - public function save($attributes=[], $remove=[], ?string $recursion=null, bool $recursion_first=true): bool |
|
1501 | + public function save($attributes = [], $remove = [], ?string $recursion = null, bool $recursion_first = true) : bool |
|
1502 | 1502 | { |
1503 | 1503 | if (!$this->isAllowed('w') && !$this->isReference()) { |
1504 | 1504 | throw new Exception\Forbidden('not allowed to modify node '.$this->name, |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | if (empty($update)) { |
1532 | 1532 | return false; |
1533 | 1533 | } else { |
1534 | - $result =$this->_db->storage->updateOne([ |
|
1534 | + $result = $this->_db->storage->updateOne([ |
|
1535 | 1535 | '_id' => $this->_id, |
1536 | 1536 | ], $update); |
1537 | 1537 | } |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | * @return array |
1568 | 1568 | */ |
1569 | 1569 | public static function loadNodeAttributesWithCustomFilter( |
1570 | - ?array $filter = null, |
|
1570 | + ? array $filter = null, |
|
1571 | 1571 | array $attributes = ['_id'], |
1572 | 1572 | ?int $limit = null, |
1573 | 1573 | ?int &$cursor = null, |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | |
1584 | 1584 | $search_attributes = array_merge($default, array_fill_keys($attributes, 1)); |
1585 | 1585 | $list = []; |
1586 | - $result =$this->_db->storage->find($filter, [ |
|
1586 | + $result = $this->_db->storage->find($filter, [ |
|
1587 | 1587 | 'skip' => $cursor, |
1588 | 1588 | 'limit' => $limit, |
1589 | 1589 | 'projection'=> $search_attributes |