@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -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 | } |
@@ -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 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param Iterable $config |
59 | 59 | * @return PluginInterface |
60 | 60 | */ |
61 | - public function setOptions(?Iterable $config): PluginInterface |
|
61 | + public function setOptions(? Iterable $config) : PluginInterface |
|
62 | 62 | { |
63 | 63 | if ($config === null) { |
64 | 64 | return $this; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'category' => get_class($this), |
101 | 101 | ]); |
102 | 102 | |
103 | - $result = $this->_findShare($share); |
|
103 | + $result = $this->_findShare($share); |
|
104 | 104 | $shares = array_merge_recursive($shares, $result); |
105 | 105 | } |
106 | 106 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'category' => get_class($this), |
122 | 122 | ]); |
123 | 123 | |
124 | - $owner = new User($owner, $this->logger, $this->fs, true); |
|
124 | + $owner = new User($owner, $this->logger, $this->fs, true); |
|
125 | 125 | $this->fs->setUser($owner); |
126 | 126 | $root = $this->fs->getRoot(); |
127 | 127 |
@@ -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 |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | * @return INode |
177 | 177 | */ |
178 | 178 | protected function _getNode( |
179 | - ?string $id=null, |
|
180 | - ?string $path=null, |
|
181 | - ?string $class=null, |
|
182 | - bool $multiple=false, |
|
183 | - bool $allow_root=false, |
|
184 | - int $deleted=2): INode |
|
179 | + ? string $id = null, |
|
180 | + ? string $path = null, |
|
181 | + ? string $class = null, |
|
182 | + bool $multiple = false, |
|
183 | + bool $allow_root = false, |
|
184 | + int $deleted = 2) : INode |
|
185 | 185 | { |
186 | 186 | if ($class === null) { |
187 | 187 | $class = join('', array_slice(explode('\\', get_class($this)), -1)); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param int $deleted |
227 | 227 | * @return Response |
228 | 228 | */ |
229 | - public function head(?string $id=null, ?string $p=null, int $deleted=0): Response |
|
229 | + public function head(? string $id = null, ? string $p = null, int $deleted = 0) : Response |
|
230 | 230 | { |
231 | 231 | try { |
232 | 232 | $result = $this->_getNode($id, $p, null, false, false, $deleted); |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | * @return void |
284 | 284 | */ |
285 | 285 | public function postUndelete( |
286 | - $id=null, |
|
287 | - ?string $p=null, |
|
288 | - bool $move=false, |
|
289 | - ?string $destid=null, |
|
290 | - ?string $destp=null, |
|
291 | - int $conflict=0): Response |
|
286 | + $id = null, |
|
287 | + ? string $p = null, |
|
288 | + bool $move = false, |
|
289 | + ? string $destid = null, |
|
290 | + ? string $destp = null, |
|
291 | + int $conflict = 0) : Response |
|
292 | 292 | { |
293 | 293 | if ($move == true) { |
294 | 294 | try { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param array $options |
381 | 381 | * @return Response |
382 | 382 | */ |
383 | - public function postShareLink(?string $id=null, ?string $p=null, array $options=[]): Response |
|
383 | + public function postShareLink(? string $id = null, ? string $p = null, array $options = []) : Response |
|
384 | 384 | { |
385 | 385 | $node = $this->_getNode($id, $p); |
386 | 386 | $options = Helper::filter($options); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param string $p |
412 | 412 | * @return Response |
413 | 413 | */ |
414 | - public function deleteShareLink(?string $id=null, ?string $p=null): Response |
|
414 | + public function deleteShareLink(? string $id = null, ? string $p = null) : Response |
|
415 | 415 | { |
416 | 416 | $node = $this->_getNode($id, $p); |
417 | 417 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * @param string $p |
455 | 455 | * @return Response |
456 | 456 | */ |
457 | - public function getShareLink(?string $id=null, ?string $p=null): Response |
|
457 | + public function getShareLink(? string $id = null, ? string $p = null) : Response |
|
458 | 458 | { |
459 | 459 | $result = Helper::escape( |
460 | 460 | $this->_getNode($id, $p)->getShareLink() |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | * @return void |
511 | 511 | */ |
512 | 512 | public function get( |
513 | - $id=null, |
|
514 | - ?string $p=null, |
|
515 | - int $offset=0, |
|
516 | - int $length=0, |
|
517 | - ?string $encode=null, |
|
518 | - bool $download=false, |
|
519 | - string $name='selected'): void |
|
513 | + $id = null, |
|
514 | + ? string $p = null, |
|
515 | + int $offset = 0, |
|
516 | + int $length = 0, |
|
517 | + ? string $encode = null, |
|
518 | + bool $download = false, |
|
519 | + string $name = 'selected') : void |
|
520 | 520 | { |
521 | 521 | if (is_array($id)) { |
522 | 522 | $this->_combine($id, $p, $name); |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | } |
534 | 534 | |
535 | 535 | if ($download == true) { |
536 | - header('Content-Disposition: attachment; filename*=UTF-8\'\'' .rawurlencode($name)); |
|
536 | + header('Content-Disposition: attachment; filename*=UTF-8\'\''.rawurlencode($name)); |
|
537 | 537 | header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
538 | 538 | header('Content-Type: application/octet-stream'); |
539 | 539 | header('Content-Length: '.$node->getSize()); |
540 | 540 | header('Content-Transfer-Encoding: binary'); |
541 | 541 | } else { |
542 | - header('Content-Disposition: inline; filename*=UTF-8\'\'' .rawurlencode($name)); |
|
542 | + header('Content-Disposition: inline; filename*=UTF-8\'\''.rawurlencode($name)); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | if ($stream === null) { |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @param string $p |
609 | 609 | * @return Response |
610 | 610 | */ |
611 | - public function postReadonly($id=null, ?string $p=null, bool $readonly=true): Response |
|
611 | + public function postReadonly($id = null, ? string $p = null, bool $readonly = true) : Response |
|
612 | 612 | { |
613 | 613 | if (is_array($id)) { |
614 | 614 | $failures = []; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * @param string $name |
652 | 652 | * @return void |
653 | 653 | */ |
654 | - protected function _combine($id=null, ?string $path=null, string $name='selected'): void |
|
654 | + protected function _combine($id = null, ? string $path = null, string $name = 'selected') : void |
|
655 | 655 | { |
656 | 656 | $temp = $this->config->dir->temp.DIRECTORY_SEPARATOR.'zip'; |
657 | 657 | if (!file_exists($temp)) { |
@@ -776,10 +776,10 @@ discard block |
||
776 | 776 | * @param array $attributes |
777 | 777 | * @return Response |
778 | 778 | */ |
779 | - public function getAttributes($id=null, ?string $p=null, array $attributes=[]): Response |
|
779 | + public function getAttributes($id = null, ? string $p = null, array $attributes = []) : Response |
|
780 | 780 | { |
781 | 781 | if (is_array($id)) { |
782 | - $nodes = []; |
|
782 | + $nodes = []; |
|
783 | 783 | foreach ($this->fs->findNodes($id) as $node) { |
784 | 784 | $nodes[] = Helper::escape($node->getAttribute($attributes)); |
785 | 785 | } |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | * @param array $attributes |
906 | 906 | * @return Response |
907 | 907 | */ |
908 | - public function getParent(?string $id=null, ?string $p=null, array $attributes=[]): Response |
|
908 | + public function getParent(? string $id = null, ? string $p = null, array $attributes = []) : Response |
|
909 | 909 | { |
910 | 910 | $result = Helper::escape( |
911 | 911 | $this->_getNode($id, $p) |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | * @param array $attributes |
988 | 988 | * @return Response |
989 | 989 | */ |
990 | - public function getParents(?string $id=null, ?string $p=null, array $attributes=[], bool $self=false): Response |
|
990 | + public function getParents(? string $id = null, ? string $p = null, array $attributes = [], bool $self = false) : Response |
|
991 | 991 | { |
992 | 992 | $request = $this->_getNode($id, $p); |
993 | 993 | $parents = $request->getParents(); |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | * @param string $p |
1036 | 1036 | * @return Response |
1037 | 1037 | */ |
1038 | - public function postMetaAttributes(?string $id=null, ?string $p=null): Response |
|
1038 | + public function postMetaAttributes(? string $id = null, ? string $p = null) : Response |
|
1039 | 1039 | { |
1040 | 1040 | $this->_getNode($id, $p)->setMetaAttribute(Helper::filter($_POST)); |
1041 | 1041 | return (new Response())->setCode(204); |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | * @param string $name |
1069 | 1069 | * @return Response |
1070 | 1070 | */ |
1071 | - public function postName(string $name, ?string $id=null, ?string $p=null): Response |
|
1071 | + public function postName(string $name, ? string $id = null, ? string $p = null) : Response |
|
1072 | 1072 | { |
1073 | 1073 | $this->_getNode($id, $p)->setName($name); |
1074 | 1074 | return (new Response())->setCode(204); |
@@ -1106,11 +1106,11 @@ discard block |
||
1106 | 1106 | * @return Response |
1107 | 1107 | */ |
1108 | 1108 | public function postClone( |
1109 | - $id=null, |
|
1110 | - ?string $p=null, |
|
1111 | - ?string $destid=null, |
|
1112 | - ?string $destp=null, |
|
1113 | - int $conflict=0): Response |
|
1109 | + $id = null, |
|
1110 | + ? string $p = null, |
|
1111 | + ? string $destid = null, |
|
1112 | + ? string $destp = null, |
|
1113 | + int $conflict = 0) : Response |
|
1114 | 1114 | { |
1115 | 1115 | try { |
1116 | 1116 | $parent = $this->_getNode($destid, $destp, 'Collection', false, true); |
@@ -1192,11 +1192,11 @@ discard block |
||
1192 | 1192 | * @return Response |
1193 | 1193 | */ |
1194 | 1194 | public function postMove( |
1195 | - $id=null, |
|
1196 | - ?string $p=null, |
|
1197 | - ?string $destid=null, |
|
1198 | - ?string $destp=null, |
|
1199 | - int $conflict=0): Response |
|
1195 | + $id = null, |
|
1196 | + ? string $p = null, |
|
1197 | + ? string $destid = null, |
|
1198 | + ? string $destp = null, |
|
1199 | + int $conflict = 0) : Response |
|
1200 | 1200 | { |
1201 | 1201 | try { |
1202 | 1202 | $parent = $this->_getNode($destid, $destp, 'Collection', false, true); |
@@ -1276,11 +1276,11 @@ discard block |
||
1276 | 1276 | * @return Response |
1277 | 1277 | */ |
1278 | 1278 | public function delete( |
1279 | - $id=null, |
|
1280 | - ?string $p=null, |
|
1281 | - bool $force=false, |
|
1282 | - bool $ignore_flag=false, |
|
1283 | - ?string $at=null): Response |
|
1279 | + $id = null, |
|
1280 | + ? string $p = null, |
|
1281 | + bool $force = false, |
|
1282 | + bool $ignore_flag = false, |
|
1283 | + ? string $at = null) : Response |
|
1284 | 1284 | { |
1285 | 1285 | $failures = []; |
1286 | 1286 | |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | * @param array $attributes |
1374 | 1374 | * @return Response |
1375 | 1375 | */ |
1376 | - public function getQuery(int $deleted=0, array $filter=[], array $attributes=[]): Response |
|
1376 | + public function getQuery(int $deleted = 0, array $filter = [], array $attributes = []): Response |
|
1377 | 1377 | { |
1378 | 1378 | $children = []; |
1379 | 1379 | $nodes = $this->fs->findNodesWithCustomFilterUser($deleted, $filter); |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | * @param array $attributes |
1415 | 1415 | * @return Response |
1416 | 1416 | */ |
1417 | - public function getTrash(array $attributes=[]): Response |
|
1417 | + public function getTrash(array $attributes = []): Response |
|
1418 | 1418 | { |
1419 | 1419 | $children = []; |
1420 | 1420 | $nodes = $this->fs->findNodesWithCustomFilterUser(INode::DELETED_ONLY, ['deleted' => ['$type' => 9]]); |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | * @param int $deleted |
1490 | 1490 | * @return Response |
1491 | 1491 | */ |
1492 | - public function getSearch(array $query, array $attributes=[], int $deleted=0): Response |
|
1492 | + public function getSearch(array $query, array $attributes = [], int $deleted = 0): Response |
|
1493 | 1493 | { |
1494 | 1494 | $children = []; |
1495 | 1495 | $nodes = $this->fs->search($query, $deleted); |
@@ -1599,11 +1599,11 @@ discard block |
||
1599 | 1599 | * @return Response |
1600 | 1600 | */ |
1601 | 1601 | public function getDelta( |
1602 | - ?string $id=null, |
|
1603 | - ?string $p=null, |
|
1604 | - ?string $cursor=null, |
|
1605 | - int $limit=250, |
|
1606 | - array $attributes=[]): Response |
|
1602 | + ? string $id = null, |
|
1603 | + ? string $p = null, |
|
1604 | + ? string $cursor = null, |
|
1605 | + int $limit = 250, |
|
1606 | + array $attributes = []) : Response |
|
1607 | 1607 | { |
1608 | 1608 | if ($id !== null || $p !== null) { |
1609 | 1609 | $node = $this->_getNode($id, $p); |
@@ -1611,7 +1611,7 @@ discard block |
||
1611 | 1611 | $node = null; |
1612 | 1612 | } |
1613 | 1613 | |
1614 | - $result= $this->fs->getDelta()->getDeltaFeed($cursor, $limit, $attributes, $node); |
|
1614 | + $result = $this->fs->getDelta()->getDeltaFeed($cursor, $limit, $attributes, $node); |
|
1615 | 1615 | |
1616 | 1616 | return (new Response())->setCode(200)->setBody($result); |
1617 | 1617 | } |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | * @param int $limit |
1720 | 1720 | * @return Response |
1721 | 1721 | */ |
1722 | - public function getEventLog(?string $id=null, ?string $p=null, int $skip=0, int $limit=100): Response |
|
1722 | + public function getEventLog(? string $id = null, ? string $p = null, int $skip = 0, int $limit = 100) : Response |
|
1723 | 1723 | { |
1724 | 1724 | if ($id !== null || $p !== null) { |
1725 | 1725 | $node = $this->_getNode($id, $p); |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | * @param string $p |
1760 | 1760 | * @return Response |
1761 | 1761 | */ |
1762 | - public function getLastCursor(?string $id=null, ?string $p=null): Response |
|
1762 | + public function getLastCursor(? string $id = null, ? string $p = null) : Response |
|
1763 | 1763 | { |
1764 | 1764 | if ($id !== null || $p !== null) { |
1765 | 1765 | $node = $this->_getNode($id, $p); |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | $node = null; |
1768 | 1768 | } |
1769 | 1769 | |
1770 | - $result= $this->fs->getDelta()->getLastCursor(); |
|
1770 | + $result = $this->fs->getDelta()->getLastCursor(); |
|
1771 | 1771 | return (new Response())->setCode(200)->setBody($result); |
1772 | 1772 | } |
1773 | 1773 | } |
@@ -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 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $p |
42 | 42 | * @return Response |
43 | 43 | */ |
44 | - public function headChildren(?string $id=null, ?string $p=null): Response |
|
44 | + public function headChildren(? string $id = null, ? string $p = null) : Response |
|
45 | 45 | { |
46 | 46 | $result = $this->fs->getNode($id, $p, null, false, true); |
47 | 47 | $children = $result->getSize(); |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | * @return Response |
98 | 98 | */ |
99 | 99 | public function getChildren( |
100 | - ?string $id=null, |
|
101 | - ?string $p=null, |
|
102 | - int $deleted=0, |
|
103 | - Parameter\JSON $filter=NULL, |
|
104 | - array $attributes=[]): Response |
|
100 | + ? string $id = null, |
|
101 | + ? string $p = null, |
|
102 | + int $deleted = 0, |
|
103 | + Parameter\JSON $filter = NULL, |
|
104 | + array $attributes = []) : Response |
|
105 | 105 | { |
106 | 106 | $children = []; |
107 | 107 | $nodes = $this->fs->getNode($id, $p, null, false, true)->getChildNodes($deleted, (array)$filter); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param string $p |
153 | 153 | * @return Response |
154 | 154 | */ |
155 | - public function getShare(?string $id=null, ?string $p=null): Response |
|
155 | + public function getShare(? string $id = null, ? string $p = null) : Response |
|
156 | 156 | { |
157 | 157 | $result = $this->fs->getNode($id, $p)->getShare(); |
158 | 158 | return (new Response())->setCode(200)->setBody($result); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param array $acl |
201 | 201 | * @return Response |
202 | 202 | */ |
203 | - public function postShare(array $acl, ?string $id=null, ?string $p=null): Response |
|
203 | + public function postShare(array $acl, ? string $id = null, ? string $p = null) : Response |
|
204 | 204 | { |
205 | 205 | $node = $this->fs->getNode($id, $p); |
206 | 206 | $result = $node->share($acl); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @param string $p |
237 | 237 | * @return Response |
238 | 238 | */ |
239 | - public function deleteShare(?string $id=null, ?string $p=null): Response |
|
239 | + public function deleteShare(? string $id = null, ? string $p = null) : Response |
|
240 | 240 | { |
241 | 241 | $node = $this->fs->getNode($id, $p); |
242 | 242 | $result = $node->unshare(); |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | * @return Response |
292 | 292 | */ |
293 | 293 | public function post( |
294 | - ?string $id=null, |
|
295 | - ?string $p=null, |
|
296 | - ?string $name=null, |
|
297 | - array $attributes=[], |
|
298 | - int $conflict=0): Response |
|
294 | + ? string $id = null, |
|
295 | + ? string $p = null, |
|
296 | + ? string $name = null, |
|
297 | + array $attributes = [], |
|
298 | + int $conflict = 0) : Response |
|
299 | 299 | { |
300 | 300 | if ($p !== null && $name !== null) { |
301 | 301 | throw new Exception\InvalidArgument('p and name can not be used at the same time'); |
@@ -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 |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param array $constructor |
197 | 197 | * @return bool |
198 | 198 | */ |
199 | - public function run(array $constructor=[]): bool |
|
199 | + public function run(array $constructor = []): bool |
|
200 | 200 | { |
201 | 201 | $this->logger->info('execute requested route ['.$this->path.']', [ |
202 | 202 | 'category' => get_class($this), |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | if (!empty($body)) { |
320 | 320 | $json_params = json_decode($body, true); |
321 | 321 | } else { |
322 | - $parts = explode('&', $_SERVER['QUERY_STRING']); |
|
322 | + $parts = explode('&', $_SERVER['QUERY_STRING']); |
|
323 | 323 | if (!empty($parts)) { |
324 | 324 | $json_params = json_decode(urldecode($parts[0]), true); |
325 | 325 | } |
@@ -341,13 +341,13 @@ discard block |
||
341 | 341 | $param_value = $request_params[$param->name]; |
342 | 342 | } elseif (isset($json_params[$param->name])) { |
343 | 343 | $param_value = $json_params[$param->name]; |
344 | - } else if($optional === true) { |
|
344 | + } else if ($optional === true) { |
|
345 | 345 | $param_value = $param->getDefaultValue(); |
346 | 346 | } else { |
347 | 347 | $param_value = null; |
348 | 348 | } |
349 | 349 | |
350 | - switch($type) { |
|
350 | + switch ($type) { |
|
351 | 351 | case 'bool': |
352 | 352 | $return[$param->name] = Helper::boolParam($param_value); |
353 | 353 | break; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $return[$param->name] = (array)$param_value; |
359 | 359 | break; |
360 | 360 | default: |
361 | - if(class_exists($type) && $param_value!==null) { |
|
361 | + if (class_exists($type) && $param_value !== null) { |
|
362 | 362 | $return[$param->name] = new $type($param, $param_value); |
363 | 363 | } else { |
364 | 364 | $return[$param->name] = $param_value; |
@@ -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 |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct(\ReflectionParameter $param, $value) |
25 | 25 | { |
26 | - if(is_array($value)) { |
|
26 | + if (is_array($value)) { |
|
27 | 27 | $data = $value; |
28 | 28 | } else { |
29 | - if(!is_string($value)) { |
|
30 | - throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. ' . gettype($value).' given.'); |
|
29 | + if (!is_string($value)) { |
|
30 | + throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. '.gettype($value).' given.'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $data = json_decode($value); |
34 | 34 | |
35 | - if($data === null) { |
|
36 | - throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. ' . json_last_error_msg()); |
|
35 | + if ($data === null) { |
|
36 | + throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. '.json_last_error_msg()); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |