@@ -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 | - array $filter=[], |
|
104 | - array $attributes=[]): Response |
|
100 | + ?string $id = null, |
|
101 | + ?string $p = null, |
|
102 | + int $deleted = 0, |
|
103 | + array $filter = [], |
|
104 | + array $attributes = []) : Response |
|
105 | 105 | { |
106 | 106 | $children = []; |
107 | 107 | $nodes = $this->fs->getNode($id, $p, null, false, true)->getChildNodes($deleted, $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 |
@@ -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 |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | * @param array |
48 | 48 | **/ |
49 | 49 | protected $temp_files = [ |
50 | - '/^\._(.*)$/', // OS/X resource forks |
|
51 | - '/^.DS_Store$/', // OS/X custom folder settings |
|
50 | + '/^\._(.*)$/', // OS/X resource forks |
|
51 | + '/^.DS_Store$/', // OS/X custom folder settings |
|
52 | 52 | '/^desktop.ini$/', // Windows custom folder settings |
53 | - '/^Thumbs.db$/', // Windows thumbnail cache |
|
54 | - '/^.(.*).swpx$/', // ViM temporary files |
|
55 | - '/^.(.*).swx$/', // ViM temporary files |
|
56 | - '/^.(.*).swp$/', // ViM temporary files |
|
57 | - '/^\.dat(.*)$/', // Smultron seems to create these |
|
53 | + '/^Thumbs.db$/', // Windows thumbnail cache |
|
54 | + '/^.(.*).swpx$/', // ViM temporary files |
|
55 | + '/^.(.*).swx$/', // ViM temporary files |
|
56 | + '/^.(.*).swp$/', // ViM temporary files |
|
57 | + '/^\.dat(.*)$/', // Smultron seems to create these |
|
58 | 58 | '/^~lock.(.*)#$/', // Windows 7 lockfiles |
59 | 59 | ]; |
60 | 60 | |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | * @param bool $force |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - public function __construct(BSONDocument $node, Filesystem $fs, bool $force=false) |
|
126 | + public function __construct(BSONDocument $node, Filesystem $fs, bool $force = false) |
|
127 | 127 | { |
128 | 128 | parent::__construct($node, $fs); |
129 | 129 | |
130 | - if($force === false) { |
|
130 | + if ($force === false) { |
|
131 | 131 | $this->_verifyAccess(); |
132 | 132 | } |
133 | 133 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param bool $recursion_first |
164 | 164 | * @return INode |
165 | 165 | */ |
166 | - public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode |
|
166 | + public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode |
|
167 | 167 | { |
168 | 168 | $this->_pluginmgr->run('preCopyFile', |
169 | 169 | [$this, $parent, &$conflict, &$recursion, &$recursion_first] |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param bool $recursion_first |
321 | 321 | * @return bool |
322 | 322 | */ |
323 | - public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool |
|
323 | + public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool |
|
324 | 324 | { |
325 | 325 | if (!$this->isAllowed('w')) { |
326 | 326 | throw new Exception\Forbidden('not allowed to delete node '.$this->name, |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | } |
344 | 344 | |
345 | 345 | $ts = new UTCDateTime(); |
346 | - $this->deleted = $ts; |
|
346 | + $this->deleted = $ts; |
|
347 | 347 | $this->increaseVersion(); |
348 | 348 | |
349 | 349 | $this->history[] = [ |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | return true; |
439 | 439 | } |
440 | 440 | |
441 | - $ref = $file['metadata']['ref']; |
|
441 | + $ref = $file['metadata']['ref']; |
|
442 | 442 | |
443 | 443 | $found = false; |
444 | 444 | foreach ($ref as $key => $node) { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @param string|array $attribute |
578 | 578 | * @return array|string |
579 | 579 | */ |
580 | - public function getAttribute($attribute=[]) |
|
580 | + public function getAttribute($attribute = []) |
|
581 | 581 | { |
582 | 582 | if (empty($attribute)) { |
583 | 583 | $attribute = [ |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | { |
897 | 897 | assert(strlen($data) == 16); |
898 | 898 | |
899 | - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 |
|
900 | - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 |
|
899 | + $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100 |
|
900 | + $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10 |
|
901 | 901 | |
902 | 902 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); |
903 | 903 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | * @param array $attributes |
922 | 922 | * @return int |
923 | 923 | */ |
924 | - public function put($file, bool $new=false, array $attributes=[]): int |
|
924 | + public function put($file, bool $new = false, array $attributes = []): int |
|
925 | 925 | { |
926 | 926 | $this->_logger->debug('PUT new content data for ['.$this->_id.']', [ |
927 | 927 | 'category' => get_class($this), |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | ); |
973 | 973 | } |
974 | 974 | |
975 | - $file = $tmp_file; |
|
975 | + $file = $tmp_file; |
|
976 | 976 | } |
977 | 977 | |
978 | 978 | |
@@ -1040,10 +1040,10 @@ discard block |
||
1040 | 1040 | $this->mime = $attributes['mime']; |
1041 | 1041 | } elseif ($file !== null) { |
1042 | 1042 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
1043 | - $this->mime = finfo_file($finfo, $file); |
|
1043 | + $this->mime = finfo_file($finfo, $file); |
|
1044 | 1044 | if ($this->mime == 'application/zip' || $this->mime == 'application/vnd.ms-office') { |
1045 | 1045 | $mime = $this->getMimeTypeFromExtension($this->name); |
1046 | - if($mime !== null) { |
|
1046 | + if ($mime !== null) { |
|
1047 | 1047 | $this->mime = $mime; |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | * @param string $db mimetypes |
1137 | 1137 | * @return string |
1138 | 1138 | */ |
1139 | - public function getMimeTypeFromExtension(string $filename, string $db='/etc/mime.types'): ?string |
|
1139 | + public function getMimeTypeFromExtension(string $filename, string $db = '/etc/mime.types'): ?string |
|
1140 | 1140 | { |
1141 | 1141 | if (!is_readable($db)) { |
1142 | 1142 | throw new Exception('mime database '.$db.' was not found or is not readable'); |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | if (substr($line, 0, 1) == '#') { |
1154 | 1154 | continue; |
1155 | 1155 | } // skip comments |
1156 | - $line = rtrim($line) . " "; |
|
1156 | + $line = rtrim($line)." "; |
|
1157 | 1157 | if (!preg_match($regex, $line, $matches)) { |
1158 | 1158 | continue; |
1159 | 1159 | } // no match to the extension |
@@ -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 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string $encode |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - public function getPreview(?string $id=null, ?string $p=null, ?string $encode=null): void |
|
58 | + public function getPreview(?string $id = null, ?string $p = null, ?string $encode = null) : void |
|
59 | 59 | { |
60 | 60 | $node = $this->_getNode($id, $p); |
61 | 61 | $data = $node->getPreview(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $p |
129 | 129 | * @return Response |
130 | 130 | */ |
131 | - public function getHistory(?string $id=null, ?string $p=null): Response |
|
131 | + public function getHistory(?string $id = null, ?string $p = null) : Response |
|
132 | 132 | { |
133 | 133 | $result = Helper::escape( |
134 | 134 | $this->_getNode($id, $p)->getHistory() |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param string $version |
162 | 162 | * @return Response |
163 | 163 | */ |
164 | - public function postRestore(int $version, ?string $id=null, ?string $p=null): Response |
|
164 | + public function postRestore(int $version, ?string $id = null, ?string $p = null) : Response |
|
165 | 165 | { |
166 | 166 | $result = $this->_getNode($id, $p)->restore($version); |
167 | 167 | return (new Response())->setCode(204); |
@@ -297,15 +297,15 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function putChunk( |
299 | 299 | string $chunkgroup, |
300 | - ?string $id=null, |
|
301 | - ?string $p=null, |
|
302 | - ?string $collection=null, |
|
303 | - ?string $name=null, |
|
304 | - int $index=1, |
|
305 | - int $chunks=0, |
|
306 | - int $size=0, |
|
307 | - array $attributes=[], |
|
308 | - int $conflict=0) |
|
300 | + ?string $id = null, |
|
301 | + ?string $p = null, |
|
302 | + ?string $collection = null, |
|
303 | + ?string $name = null, |
|
304 | + int $index = 1, |
|
305 | + int $chunks = 0, |
|
306 | + int $size = 0, |
|
307 | + array $attributes = [], |
|
308 | + int $conflict = 0) |
|
309 | 309 | { |
310 | 310 | ini_set('auto_detect_line_endings', '1'); |
311 | 311 | $input_handler = fopen('php://input', 'rb'); |
@@ -464,12 +464,12 @@ discard block |
||
464 | 464 | * @return Response |
465 | 465 | */ |
466 | 466 | public function put( |
467 | - ?string $id=null, |
|
468 | - ?string $p=null, |
|
469 | - ?string $collection=null, |
|
470 | - ?string $name=null, |
|
471 | - array $attributes=[], |
|
472 | - int $conflict=0): Response |
|
467 | + ?string $id = null, |
|
468 | + ?string $p = null, |
|
469 | + ?string $collection = null, |
|
470 | + ?string $name = null, |
|
471 | + array $attributes = [], |
|
472 | + int $conflict = 0) : Response |
|
473 | 473 | { |
474 | 474 | $attributes = $this->_verifyAttributes($attributes); |
475 | 475 | |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | */ |
494 | 494 | protected function _put( |
495 | 495 | $content, |
496 | - ?string $id=null, |
|
497 | - ?string $p=null, |
|
498 | - ?string $collection=null, |
|
499 | - ?string $name=null, |
|
500 | - array $attributes=[], |
|
501 | - int $conflict=0): Response |
|
496 | + ?string $id = null, |
|
497 | + ?string $p = null, |
|
498 | + ?string $collection = null, |
|
499 | + ?string $name = null, |
|
500 | + array $attributes = [], |
|
501 | + int $conflict = 0) : Response |
|
502 | 502 | { |
503 | 503 | if ($id === null && $p === null && $name === null) { |
504 | 504 | throw new Exception\InvalidArgument('neither id, p nor name was set'); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $result = $node->put($content, false, $attributes); |
519 | 519 | return (new Response())->setCode(200)->setBody($result); |
520 | 520 | } elseif ($p === null && $id === null && $name !== null) { |
521 | - $collection = $this->_getNode($collection, null, 'Collection', false, true); |
|
521 | + $collection = $this->_getNode($collection, null, 'Collection', false, true); |
|
522 | 522 | |
523 | 523 | if ($collection->childExists($name)) { |
524 | 524 | $child = $collection->getChild($name); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | return (new Response())->setCode(201)->setBody($result); |
535 | 535 | } |
536 | 536 | } |
537 | - } catch(Exception\Forbidden $e) { |
|
537 | + } catch (Exception\Forbidden $e) { |
|
538 | 538 | throw new Exception\Conflict('a node called '.$name.' does already exists in this collection', |
539 | 539 | Exception\Conflict::NODE_WITH_SAME_NAME_ALREADY_EXISTS |
540 | 540 | ); |
@@ -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; |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | |
548 | 548 | try { |
549 | 549 | $child = $this->getParent()->getChild($name); |
550 | - if($child->getId() != $this->_id) { |
|
550 | + if ($child->getId() != $this->_id) { |
|
551 | 551 | throw new Exception\Conflict('a node called '.$name.' does already exists in this collection', |
552 | 552 | Exception\Conflict::NODE_WITH_SAME_NAME_ALREADY_EXISTS |
553 | 553 | ); |
554 | 554 | } |
555 | - } catch(Exception\NotFound $e) { |
|
555 | + } catch (Exception\NotFound $e) { |
|
556 | 556 | //child does not exists, we can safely rename |
557 | 557 | } |
558 | 558 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @param string $privilege |
601 | 601 | * @return bool |
602 | 602 | */ |
603 | - public function isAllowed(string $privilege='r'): bool |
|
603 | + public function isAllowed(string $privilege = 'r'): bool |
|
604 | 604 | { |
605 | 605 | $acl = null; |
606 | 606 | $share = null; |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | $clean[] = 'meta'; |
795 | 795 | } |
796 | 796 | |
797 | - $attribute = $clean; |
|
797 | + $attribute = $clean; |
|
798 | 798 | |
799 | 799 | try { |
800 | 800 | $sharenode = $this->getShareNode(); |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | * @param string $name |
925 | 925 | * @return string |
926 | 926 | */ |
927 | - protected function _getDuplicateName(?string $name=null): string |
|
927 | + protected function _getDuplicateName(?string $name = null) : string |
|
928 | 928 | { |
929 | 929 | if ($name === null) { |
930 | 930 | $name = $this->name; |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | if ($this instanceof Collection) { |
934 | 934 | return $name.' ('.substr(uniqid('', true), -4).')'; |
935 | 935 | } else { |
936 | - $ext = substr(strrchr($name, '.'), 1); |
|
936 | + $ext = substr(strrchr($name, '.'), 1); |
|
937 | 937 | |
938 | 938 | if ($ext === false) { |
939 | 939 | return $name.' ('.substr(uniqid('', true), -4).')'; |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | * @param bool $recursion_first |
954 | 954 | * @return bool |
955 | 955 | */ |
956 | - public function undelete(int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): bool |
|
956 | + public function undelete(int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : bool |
|
957 | 957 | { |
958 | 958 | if (!$this->isAllowed('w')) { |
959 | 959 | throw new Exception\Forbidden('not allowed to restore node '.$this->name, |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | $recursion_first = false; |
994 | 994 | } |
995 | 995 | |
996 | - $this->deleted = false; |
|
996 | + $this->deleted = false; |
|
997 | 997 | |
998 | 998 | if ($this instanceof File) { |
999 | 999 | $current = $this->version; |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | 'deleted', |
1022 | 1022 | ], [], $recursion, $recursion_first); |
1023 | 1023 | |
1024 | - if($this->isReference()) { |
|
1024 | + if ($this->isReference()) { |
|
1025 | 1025 | return true; |
1026 | 1026 | } |
1027 | 1027 | |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | * |
1152 | 1152 | * @return ObjectId|string |
1153 | 1153 | */ |
1154 | - public function getId(bool $string=false) |
|
1154 | + public function getId(bool $string = false) |
|
1155 | 1155 | { |
1156 | 1156 | if ($string === true) { |
1157 | 1157 | return (string)$this->_id; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | * @param array $parents |
1202 | 1202 | * @return array |
1203 | 1203 | */ |
1204 | - public function getParents(?INode $node=null, array $parents=[]): array |
|
1204 | + public function getParents(?INode $node = null, array $parents = []) : array |
|
1205 | 1205 | { |
1206 | 1206 | if ($node === null) { |
1207 | 1207 | $node = $this; |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | * @param int $depth |
1269 | 1269 | * @return bool |
1270 | 1270 | */ |
1271 | - public function zip(ZipStream $archive, bool $self=true, ?INode $parent=null, string $path='', int $depth=0): bool |
|
1271 | + public function zip(ZipStream $archive, bool $self = true, ?INode $parent = null, string $path = '', int $depth = 0) : bool |
|
1272 | 1272 | { |
1273 | 1273 | if ($parent === null) { |
1274 | 1274 | $parent = $this; |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * @param mixed $value |
1331 | 1331 | * @return INode |
1332 | 1332 | */ |
1333 | - public function setMetaAttribute($attributes, $value=null): INode |
|
1333 | + public function setMetaAttribute($attributes, $value = null): INode |
|
1334 | 1334 | { |
1335 | 1335 | $this->meta = self::validateMetaAttribute($attributes, $value, $this->meta); |
1336 | 1336 | $this->save('meta'); |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | * @param array $set |
1347 | 1347 | * @return array |
1348 | 1348 | */ |
1349 | - public static function validateMetaAttribute($attributes, $value=null, array $set=[]): array |
|
1349 | + public static function validateMetaAttribute($attributes, $value = null, array $set = []): array |
|
1350 | 1350 | { |
1351 | 1351 | if (is_string($attributes)) { |
1352 | 1352 | $attributes = [ |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | * @param string|array $attribute Specify attributes to return |
1378 | 1378 | * @return string|array |
1379 | 1379 | */ |
1380 | - public function getMetaAttribute($attribute=[]) |
|
1380 | + public function getMetaAttribute($attribute = []) |
|
1381 | 1381 | { |
1382 | 1382 | if (is_string($attribute)) { |
1383 | 1383 | if (isset($this->meta[$attribute])) { |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | * @param bool $readonly |
1398 | 1398 | * @return bool |
1399 | 1399 | */ |
1400 | - public function setReadonly(bool $readonly=true): bool |
|
1400 | + public function setReadonly(bool $readonly = true): bool |
|
1401 | 1401 | { |
1402 | 1402 | $this->readonly = $readonly; |
1403 | 1403 | return $this->save('readonly'); |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | * @param UTCDateTime $ts |
1411 | 1411 | * @return bool |
1412 | 1412 | */ |
1413 | - public function setDestroyable(?UTCDateTime $ts): bool |
|
1413 | + public function setDestroyable(?UTCDateTime $ts) : bool |
|
1414 | 1414 | { |
1415 | 1415 | $this->destroy = $ts; |
1416 | 1416 | |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | * @param string $recursion |
1434 | 1434 | * @return bool |
1435 | 1435 | */ |
1436 | - abstract public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool; |
|
1436 | + abstract public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool; |
|
1437 | 1437 | |
1438 | 1438 | |
1439 | 1439 | /** |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | * @param bool $recursion_first |
1504 | 1504 | * @return bool |
1505 | 1505 | */ |
1506 | - public function save($attributes=[], $remove=[], ?string $recursion=null, bool $recursion_first=true): bool |
|
1506 | + public function save($attributes = [], $remove = [], ?string $recursion = null, bool $recursion_first = true) : bool |
|
1507 | 1507 | { |
1508 | 1508 | if (!$this->isAllowed('w') && !$this->isReference()) { |
1509 | 1509 | throw new Exception\Forbidden('not allowed to modify node '.$this->name, |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | if (empty($update)) { |
1537 | 1537 | return false; |
1538 | 1538 | } else { |
1539 | - $result =$this->_db->storage->updateOne([ |
|
1539 | + $result = $this->_db->storage->updateOne([ |
|
1540 | 1540 | '_id' => $this->_id, |
1541 | 1541 | ], $update); |
1542 | 1542 | } |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | * @return array |
1573 | 1573 | */ |
1574 | 1574 | public static function loadNodeAttributesWithCustomFilter( |
1575 | - ?array $filter = null, |
|
1575 | + ? array $filter = null, |
|
1576 | 1576 | array $attributes = ['_id'], |
1577 | 1577 | ?int $limit = null, |
1578 | 1578 | ?int &$cursor = null, |
@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | |
1589 | 1589 | $search_attributes = array_merge($default, array_fill_keys($attributes, 1)); |
1590 | 1590 | $list = []; |
1591 | - $result =$this->_db->storage->find($filter, [ |
|
1591 | + $result = $this->_db->storage->find($filter, [ |
|
1592 | 1592 | 'skip' => $cursor, |
1593 | 1593 | 'limit' => $limit, |
1594 | 1594 | 'projection'=> $search_attributes |
@@ -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 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param bool $force |
74 | 74 | * @return void |
75 | 75 | */ |
76 | - public function __construct(?BSONDocument $node, Filesystem $fs, bool $force=false) |
|
76 | + public function __construct(?BSONDocument $node, Filesystem $fs, bool $force = false) |
|
77 | 77 | { |
78 | 78 | parent::__construct($node, $fs); |
79 | 79 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $this->_id = null; |
82 | 82 | |
83 | 83 | if ($this->_user instanceof User) { |
84 | - $this->owner = $this->_user->getId(); |
|
84 | + $this->owner = $this->_user->getId(); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if($force === false) { |
|
88 | + if ($force === false) { |
|
89 | 89 | $this->_verifyAccess(); |
90 | 90 | } |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param bool $recursion_first |
101 | 101 | * @return INode |
102 | 102 | */ |
103 | - public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode |
|
103 | + public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode |
|
104 | 104 | { |
105 | 105 | if ($recursion === null) { |
106 | 106 | $recursion_first = true; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param array|string $attribute |
201 | 201 | * @return array|string |
202 | 202 | */ |
203 | - public function getAttribute($attribute=[]) |
|
203 | + public function getAttribute($attribute = []) |
|
204 | 204 | { |
205 | 205 | if (empty($attribute)) { |
206 | 206 | $attribute = [ |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param array $filter |
247 | 247 | * @return Generator |
248 | 248 | */ |
249 | - public function getChildNodes(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): Generator |
|
249 | + public function getChildNodes(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): Generator |
|
250 | 250 | { |
251 | 251 | if ($this->_user instanceof User) { |
252 | 252 | $this->_user->findNewShares(); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | if (!empty($this->filter)) { |
301 | - if(is_string($this->filter)) { |
|
301 | + if (is_string($this->filter)) { |
|
302 | 302 | $filter = json_decode($this->filter, true); |
303 | 303 | } else { |
304 | 304 | $filter = $this->filter; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param array $filter |
324 | 324 | * @return Generator |
325 | 325 | */ |
326 | - public function getChildren(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): array |
|
326 | + public function getChildren(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): array |
|
327 | 327 | { |
328 | 328 | return iterator_to_array($this->getChildNodes($deleted, $filter)); |
329 | 329 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @param array $filter |
395 | 395 | * @return INode |
396 | 396 | */ |
397 | - public function getChild($node, int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): INode |
|
397 | + public function getChild($node, int $deleted = INode::DELETED_EXCLUDE, array $filter = []): INode |
|
398 | 398 | { |
399 | 399 | //if $node is string load the object from the backend based on the current parent (the name |
400 | 400 | //is unique per depth, so we can load the object) |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param int $deleted |
464 | 464 | * @return bool |
465 | 465 | */ |
466 | - protected function doRecursiveAction(string $method, array $params=[], int $deleted=INode::DELETED_EXCLUDE): bool |
|
466 | + protected function doRecursiveAction(string $method, array $params = [], int $deleted = INode::DELETED_EXCLUDE): bool |
|
467 | 467 | { |
468 | 468 | if (!is_callable([$this, $method])) { |
469 | 469 | throw new Exception("method $method is not callable in ".__CLASS__); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param bool $recursion_first |
491 | 491 | * @return bool |
492 | 492 | */ |
493 | - public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool |
|
493 | + public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool |
|
494 | 494 | { |
495 | 495 | if (!$this->isAllowed('w') && !$this->isReference()) { |
496 | 496 | throw new Exception\Forbidden('not allowed to delete node '.$this->name, |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @param bool $recursion_first |
554 | 554 | * @return bool |
555 | 555 | */ |
556 | - protected function _forceDelete(?string $recursion=null, bool $recursion_first=true): bool |
|
556 | + protected function _forceDelete(?string $recursion = null, bool $recursion_first = true) : bool |
|
557 | 557 | { |
558 | 558 | if (!$this->isReference()) { |
559 | 559 | $this->doRecursiveAction('delete', [ |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @param array $filter |
606 | 606 | * @return bool |
607 | 607 | */ |
608 | - public function childExists($name, $deleted=INode::DELETED_EXCLUDE, array $filter=[]): bool |
|
608 | + public function childExists($name, $deleted = INode::DELETED_EXCLUDE, array $filter = []): bool |
|
609 | 609 | { |
610 | 610 | $find = [ |
611 | 611 | 'parent' => $this->getRealId(), |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | } |
740 | 740 | |
741 | 741 | $this->shared = false; |
742 | - $this->acl = null; |
|
742 | + $this->acl = null; |
|
743 | 743 | $action = [ |
744 | 744 | '$unset' => [ |
745 | 745 | 'shared' => $this->_id |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @param arary $files |
800 | 800 | * @return array |
801 | 801 | */ |
802 | - public function getChildrenRecursive(?ObjectId $id=null, ?array &$shares=[], ?array &$files=[]): array |
|
802 | + public function getChildrenRecursive(?ObjectId $id = null, ? array &$shares = [], ? array &$files = []) : array |
|
803 | 803 | { |
804 | 804 | $list = []; |
805 | 805 | $result = $this->_db->storage->find([ |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * @param bool $clone |
844 | 844 | * @return Collection |
845 | 845 | */ |
846 | - public function addDirectory($name, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): Collection |
|
846 | + public function addDirectory($name, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): Collection |
|
847 | 847 | { |
848 | 848 | if (!$this->isAllowed('w')) { |
849 | 849 | throw new Exception\Forbidden('not allowed to create new node here', |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | 'shared' => ($this->shared === true ? $this->getRealId() : $this->shared) |
891 | 891 | ]; |
892 | 892 | |
893 | - $save = array_merge($meta, $attributes); |
|
893 | + $save = array_merge($meta, $attributes); |
|
894 | 894 | |
895 | 895 | $result = $this->_db->storage->insertOne($save); |
896 | 896 | $save['_id'] = $result->getInsertedId(); |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | 'category' => get_class($this), |
900 | 900 | ]); |
901 | 901 | |
902 | - if(!$this->isRoot()) { |
|
902 | + if (!$this->isRoot()) { |
|
903 | 903 | $this->changed = $save['changed']; |
904 | 904 | $this->save('changed'); |
905 | 905 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * @param bool $clone |
929 | 929 | * @return File |
930 | 930 | */ |
931 | - public function addFile($name, $data=null, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): File |
|
931 | + public function addFile($name, $data = null, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): File |
|
932 | 932 | { |
933 | 933 | if (!$this->isAllowed('w')) { |
934 | 934 | throw new Exception\Forbidden('not allowed to create new node here', |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | 'shared' => ($this->shared === true ? $this->getRealId() : $this->shared), |
979 | 979 | ]; |
980 | 980 | |
981 | - $save = array_merge($meta, $attributes); |
|
981 | + $save = array_merge($meta, $attributes); |
|
982 | 982 | |
983 | 983 | $result = $this->_db->storage->insertOne($save); |
984 | 984 | $save['_id'] = $result->getInsertedId(); |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | 'category' => get_class($this), |
988 | 988 | ]); |
989 | 989 | |
990 | - if(!$this->isRoot()) { |
|
990 | + if (!$this->isRoot()) { |
|
991 | 991 | $this->changed = $save['changed']; |
992 | 992 | $this->save('changed'); |
993 | 993 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | * @param string $data |
1034 | 1034 | * @return File |
1035 | 1035 | */ |
1036 | - public function createFile($name, $data=null): String |
|
1036 | + public function createFile($name, $data = null): String |
|
1037 | 1037 | { |
1038 | 1038 | return $this->addFile($name, $data)->getETag(); |
1039 | 1039 | } |
@@ -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 |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @param int $deleted |
296 | 296 | * @return INode |
297 | 297 | */ |
298 | - public function findNodeWithId($id, ?string $class=null, int $deleted=INode::DELETED_INCLUDE): INode |
|
298 | + public function findNodeWithId($id, ?string $class = null, int $deleted = INode::DELETED_INCLUDE) : INode |
|
299 | 299 | { |
300 | 300 | if (!is_string($id) && !($id instanceof ObjectID)) { |
301 | 301 | throw new Exception\InvalidArgument($id.' node id has to be a string or instance of \MongoDB\BSON\ObjectID'); |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param string $class Fore check node type |
354 | 354 | * @return INode |
355 | 355 | */ |
356 | - public function findNodeWithPath(string $path='', ?string $class=null): INode |
|
356 | + public function findNodeWithPath(string $path = '', ?string $class = null) : INode |
|
357 | 357 | { |
358 | 358 | if (empty($path) || $path[0] != '/') { |
359 | 359 | $path = '/'.$path; |
360 | 360 | } |
361 | 361 | |
362 | - $last = strlen($path)-1; |
|
362 | + $last = strlen($path) - 1; |
|
363 | 363 | if ($path[$last] == '/') { |
364 | 364 | $path = substr($path, 0, -1); |
365 | 365 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @param string $class Fore check node type |
391 | 391 | * @return INode |
392 | 392 | */ |
393 | - public function findNodeWithShareToken(string $token, ?string $class=null): INode |
|
393 | + public function findNodeWithShareToken(string $token, ?string $class = null) : INode |
|
394 | 394 | { |
395 | 395 | $node = $this->db->storage->findOne([ |
396 | 396 | 'sharelink.token' => $token, |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @param bool $deleted |
435 | 435 | * @return Generator |
436 | 436 | */ |
437 | - public function findNodes(array $id=[], ?string $class=null, int $deleted=INode::DELETED_INCLUDE): Generator |
|
437 | + public function findNodes(array $id = [], ?string $class = null, int $deleted = INode::DELETED_INCLUDE) : Generator |
|
438 | 438 | { |
439 | 439 | $id = (array)$id; |
440 | 440 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param int $deleted |
489 | 489 | * @return array |
490 | 490 | */ |
491 | - public function search(array $query, int $deleted=INode::DELETED_INCLUDE): array |
|
491 | + public function search(array $query, int $deleted = INode::DELETED_INCLUDE): array |
|
492 | 492 | { |
493 | 493 | if ($this->user instanceof User) { |
494 | 494 | $this->user->findNewShares(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | ->setHosts((array)$this->config->search->hosts->server) |
583 | 583 | ->build(); |
584 | 584 | |
585 | - $bool = $query['body']['query']; |
|
585 | + $bool = $query['body']['query']; |
|
586 | 586 | |
587 | 587 | $filter1 = []; |
588 | 588 | $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId(); |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @param bool $deleted How to handle deleted node |
651 | 651 | * @return INode |
652 | 652 | */ |
653 | - public function getNode($id=null, $path=null, $class=null, $multiple=false, $allow_root=false, $deleted=null) |
|
653 | + public function getNode($id = null, $path = null, $class = null, $multiple = false, $allow_root = false, $deleted = null) |
|
654 | 654 | { |
655 | 655 | if (empty($id) && empty($path)) { |
656 | 656 | if ($allow_root === true) { |
@@ -766,21 +766,21 @@ discard block |
||
766 | 766 | * @return array |
767 | 767 | */ |
768 | 768 | public function findNodeAttributesWithCustomFilter( |
769 | - ?array $filter = null, |
|
769 | + ? array $filter = null, |
|
770 | 770 | array $attributes = ['_id'], |
771 | 771 | ?int $limit = null, |
772 | 772 | ?int &$cursor = null, |
773 | 773 | ?bool &$has_more = null, |
774 | 774 | ?INode $parent = null) |
775 | 775 | { |
776 | - $list = []; |
|
776 | + $list = []; |
|
777 | 777 | |
778 | - $result =$this->db->storage->find($filter, [ |
|
778 | + $result = $this->db->storage->find($filter, [ |
|
779 | 779 | 'skip' => $cursor, |
780 | 780 | 'limit' => $limit, |
781 | 781 | ]); |
782 | 782 | |
783 | - $left =$this->db->storage->count($filter, [ |
|
783 | + $left = $this->db->storage->count($filter, [ |
|
784 | 784 | 'skip' => $cursor, |
785 | 785 | ]); |
786 | 786 |