@@ -13,11 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | use \Sabre\DAV; |
| 15 | 15 | use Balloon\Exception; |
| 16 | -use Balloon\Helper; |
|
| 17 | 16 | use Balloon\User; |
| 18 | 17 | use Balloon\Resource; |
| 19 | 18 | use \Psr\Log\LoggerInterface as Logger; |
| 20 | -use Balloon\Plugin; |
|
| 21 | 19 | use Balloon\Filesystem; |
| 22 | 20 | use \MongoDB\BSON\ObjectId; |
| 23 | 21 | use \MongoDB\BSON\UTCDateTime; |
@@ -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 | } |
@@ -655,7 +655,6 @@ |
||
| 655 | 655 | /** |
| 656 | 656 | * Set thumbnail |
| 657 | 657 | * |
| 658 | - * @param resource $thumbnail |
|
| 659 | 658 | * @return ObjectId |
| 660 | 659 | */ |
| 661 | 660 | protected function storePreview(string $content): ObjectId |
@@ -14,10 +14,8 @@ |
||
| 14 | 14 | use \Sabre\DAV; |
| 15 | 15 | use Balloon\Exception; |
| 16 | 16 | use Balloon\Helper; |
| 17 | -use Balloon\Queue; |
|
| 18 | 17 | use Balloon\User; |
| 19 | 18 | use \Psr\Log\LoggerInterface as Logger; |
| 20 | -use Balloon\Plugin; |
|
| 21 | 19 | use Balloon\Filesystem; |
| 22 | 20 | use \MongoDB\BSON\ObjectId; |
| 23 | 21 | use \MongoDB\BSON\UTCDateTime; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $v = (array)$version; |
| 206 | 206 | |
| 207 | 207 | $v['user'] = (new User($version['user'], $this->_logger, $this->_fs)) |
| 208 | - ->getUsername(); |
|
| 208 | + ->getUsername(); |
|
| 209 | 209 | $v['changed'] = Helper::DateTimeToUnix($version['changed']); |
| 210 | 210 | $filtered[] = $v; |
| 211 | 211 | } |
@@ -597,15 +597,15 @@ discard block |
||
| 597 | 597 | $build = []; |
| 598 | 598 | foreach ($requested as $key => $attr) { |
| 599 | 599 | switch ($attr) { |
| 600 | - case 'hash': |
|
| 600 | + case 'hash': |
|
| 601 | 601 | case 'version': |
| 602 | 602 | case 'thumbnail': |
| 603 | 603 | $build[$attr] = $this->{$attr}; |
| 604 | - break; |
|
| 604 | + break; |
|
| 605 | 605 | |
| 606 | - case 'history': |
|
| 606 | + case 'history': |
|
| 607 | 607 | $build['history'] = $this->getHistory(); |
| 608 | - break; |
|
| 608 | + break; |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | //somehow mongo-connector does not catch metadata when set during uploadFromStream() |
| 871 | 871 | $stream = $bucket->uploadFromStream($id, $contents, ['_id' => $id/*, 'metadata' => $file*/]); |
| 872 | 872 | $this->_db->{'fs.files'}->updateOne(['_id' => $id], [ |
| 873 | - '$set' => ['metadata'=> $file] |
|
| 873 | + '$set' => ['metadata'=> $file] |
|
| 874 | 874 | ]); |
| 875 | 875 | |
| 876 | 876 | $this->_logger->info('added new gridfs content node ['.$id.'] for file ['.$this->_id.']', [ |
@@ -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 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param bool $recursion_first |
| 160 | 160 | * @return INode |
| 161 | 161 | */ |
| 162 | - public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode |
|
| 162 | + public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ? string $recursion = null, bool $recursion_first = true) : INode |
|
| 163 | 163 | { |
| 164 | 164 | $this->_pluginmgr->run('preCopyFile', |
| 165 | 165 | [$this, $parent, &$conflict, &$recursion, &$recursion_first] |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @param bool $recursion_first |
| 317 | 317 | * @return bool |
| 318 | 318 | */ |
| 319 | - public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool |
|
| 319 | + public function delete(bool $force = false, ? string $recursion = null, bool $recursion_first = true) : bool |
|
| 320 | 320 | { |
| 321 | 321 | if (!$this->isAllowed('w')) { |
| 322 | 322 | throw new Exception\Forbidden('not allowed to delete node '.$this->name, |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $ts = new UTCDateTime(); |
| 342 | - $this->deleted = $ts; |
|
| 342 | + $this->deleted = $ts; |
|
| 343 | 343 | $this->increaseVersion(); |
| 344 | 344 | |
| 345 | 345 | $this->history[] = [ |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | return true; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $ref = $file['metadata']['ref']; |
|
| 437 | + $ref = $file['metadata']['ref']; |
|
| 438 | 438 | |
| 439 | 439 | $found = false; |
| 440 | 440 | foreach ($ref as $key => $node) { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @param string|array $attribute |
| 574 | 574 | * @return array|string |
| 575 | 575 | */ |
| 576 | - public function getAttribute($attribute=[]) |
|
| 576 | + public function getAttribute($attribute = []) |
|
| 577 | 577 | { |
| 578 | 578 | if (empty($attribute)) { |
| 579 | 579 | $attribute = [ |
@@ -892,8 +892,8 @@ discard block |
||
| 892 | 892 | { |
| 893 | 893 | assert(strlen($data) == 16); |
| 894 | 894 | |
| 895 | - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 |
|
| 896 | - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 |
|
| 895 | + $data[6] = chr(ord($data[6])&0x0f|0x40); // set version to 0100 |
|
| 896 | + $data[8] = chr(ord($data[8])&0x3f|0x80); // set bits 6-7 to 10 |
|
| 897 | 897 | |
| 898 | 898 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); |
| 899 | 899 | } |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | * @param array $attributes |
| 918 | 918 | * @return int |
| 919 | 919 | */ |
| 920 | - public function put($file, bool $new=false, array $attributes=[]): int |
|
| 920 | + public function put($file, bool $new = false, array $attributes = []): int |
|
| 921 | 921 | { |
| 922 | 922 | $this->_logger->debug('PUT new content data for ['.$this->_id.']', [ |
| 923 | 923 | 'category' => get_class($this), |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | ); |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $file = $tmp_file; |
|
| 971 | + $file = $tmp_file; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | $this->mime = $attributes['mime']; |
| 1037 | 1037 | } elseif ($file !== null) { |
| 1038 | 1038 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 1039 | - $this->mime = finfo_file($finfo, $file); |
|
| 1039 | + $this->mime = finfo_file($finfo, $file); |
|
| 1040 | 1040 | if ($this->mime == 'application/zip' || $this->mime == 'application/vnd.ms-office') { |
| 1041 | 1041 | $this->mime = $this->getMimeTypeFromExtension($this->name); |
| 1042 | 1042 | } |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | * @param string $db mimetypes |
| 1130 | 1130 | * @return string |
| 1131 | 1131 | */ |
| 1132 | - public function getMimeTypeFromExtension(string $filename, string $db='/etc/mime.types'): string |
|
| 1132 | + public function getMimeTypeFromExtension(string $filename, string $db = '/etc/mime.types'): string |
|
| 1133 | 1133 | { |
| 1134 | 1134 | if (!is_readable($db)) { |
| 1135 | 1135 | throw new Exception('mime database '.$db.' was not found or is not readable'); |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | if (substr($line, 0, 1) == '#') { |
| 1147 | 1147 | continue; |
| 1148 | 1148 | } // skip comments |
| 1149 | - $line = rtrim($line) . " "; |
|
| 1149 | + $line = rtrim($line)." "; |
|
| 1150 | 1150 | if (!preg_match($regex, $line, $matches)) { |
| 1151 | 1151 | continue; |
| 1152 | 1152 | } // no match to the extension |
@@ -443,7 +443,6 @@ discard block |
||
| 443 | 443 | /** |
| 444 | 444 | * Get share node |
| 445 | 445 | * |
| 446 | - * @param bool $reference |
|
| 447 | 446 | * @return Collection |
| 448 | 447 | */ |
| 449 | 448 | public function getShareNode(): ?Collection |
@@ -1231,7 +1230,7 @@ discard block |
||
| 1231 | 1230 | /** |
| 1232 | 1231 | * Get as zip |
| 1233 | 1232 | * |
| 1234 | - * @return void |
|
| 1233 | + * @return resource |
|
| 1235 | 1234 | */ |
| 1236 | 1235 | public function getZip(): void |
| 1237 | 1236 | { |
@@ -893,7 +893,7 @@ |
||
| 893 | 893 | case 'shareowner': |
| 894 | 894 | if ($this->isSpecial() && $sharenode !== null) { |
| 895 | 895 | $build['shareowner'] = (new User($this->_fs->findRawNode($this->getShareId())['owner'], |
| 896 | - $this->_logger, $this->_fs) |
|
| 896 | + $this->_logger, $this->_fs) |
|
| 897 | 897 | )->getUsername(); |
| 898 | 898 | } |
| 899 | 899 | break; |
@@ -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 |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param Filesystem $fs |
| 222 | 222 | * @return void |
| 223 | 223 | */ |
| 224 | - public function __construct(?BSONDocument $node, Filesystem $fs) |
|
| 224 | + public function __construct(? BSONDocument $node, Filesystem $fs) |
|
| 225 | 225 | { |
| 226 | 226 | $this->_fs = $fs; |
| 227 | 227 | $this->_db = $fs->getDatabase(); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return mixed |
| 271 | 271 | */ |
| 272 | - public function __call(string $attribute, array $params=[]) |
|
| 272 | + public function __call(string $attribute, array $params = []) |
|
| 273 | 273 | { |
| 274 | 274 | $prefix = 'get'; |
| 275 | 275 | $attr = strtolower(substr($attribute, 3)); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param int $conflict |
| 315 | 315 | * @return INode |
| 316 | 316 | */ |
| 317 | - public function setParent(Collection $parent, int $conflict=INode::CONFLICT_NOACTION): INode |
|
| 317 | + public function setParent(Collection $parent, int $conflict = INode::CONFLICT_NOACTION): INode |
|
| 318 | 318 | { |
| 319 | 319 | if ($this->parent === $parent->getId()) { |
| 320 | 320 | throw new Exception\Conflict('source node '.$this->name.' is already in the requested parent folder', |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * @param bool $recursion_first |
| 390 | 390 | * @return INode |
| 391 | 391 | */ |
| 392 | - abstract public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode; |
|
| 392 | + abstract public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ? string $recursion = null, bool $recursion_first = true) : INode; |
|
| 393 | 393 | |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | * @param bool $reference |
| 399 | 399 | * @return ObjectId |
| 400 | 400 | */ |
| 401 | - public function getShareId(bool $reference=false): ?ObjectId |
|
| 401 | + public function getShareId(bool $reference = false): ? ObjectId |
|
| 402 | 402 | { |
| 403 | 403 | if ($this->isReference() && $reference === true) { |
| 404 | 404 | return $this->_id; |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param bool $reference |
| 447 | 447 | * @return Collection |
| 448 | 448 | */ |
| 449 | - public function getShareNode(): ?Collection |
|
| 449 | + public function getShareNode(): ? Collection |
|
| 450 | 450 | { |
| 451 | 451 | if ($this->isSpecial()) { |
| 452 | 452 | return $this->_fs->findNodeWithId($this->getShareId(true)); |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | * @param string $privilege |
| 595 | 595 | * @return bool |
| 596 | 596 | */ |
| 597 | - public function isAllowed(string $privilege='r'): bool |
|
| 597 | + public function isAllowed(string $privilege = 'r'): bool |
|
| 598 | 598 | { |
| 599 | 599 | $acl = null; |
| 600 | 600 | $share = null; |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | $clean[] = 'meta'; |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - $attribute = $clean; |
|
| 791 | + $attribute = $clean; |
|
| 792 | 792 | |
| 793 | 793 | try { |
| 794 | 794 | $sharenode = $this->getShareNode(); |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | * @param string $name |
| 919 | 919 | * @return string |
| 920 | 920 | */ |
| 921 | - protected function _getDuplicateName(?string $name=null): string |
|
| 921 | + protected function _getDuplicateName(? string $name = null) : string |
|
| 922 | 922 | { |
| 923 | 923 | if ($name === null) { |
| 924 | 924 | $name = $this->name; |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | if ($this instanceof Collection) { |
| 928 | 928 | return $name.' ('.substr(uniqid('', true), -4).')'; |
| 929 | 929 | } else { |
| 930 | - $ext = substr(strrchr($name, '.'), 1); |
|
| 930 | + $ext = substr(strrchr($name, '.'), 1); |
|
| 931 | 931 | |
| 932 | 932 | if ($ext === false) { |
| 933 | 933 | return $name.' ('.substr(uniqid('', true), -4).')'; |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | * @param bool $recursion_first |
| 948 | 948 | * @return bool |
| 949 | 949 | */ |
| 950 | - public function undelete(int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): bool |
|
| 950 | + public function undelete(int $conflict = INode::CONFLICT_NOACTION, ? string $recursion = null, bool $recursion_first = true) : bool |
|
| 951 | 951 | { |
| 952 | 952 | if (!$this->isAllowed('w')) { |
| 953 | 953 | throw new Exception\Forbidden('not allowed to restore node '.$this->name, |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | $recursion_first = false; |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - $this->deleted = false; |
|
| 990 | + $this->deleted = false; |
|
| 991 | 991 | |
| 992 | 992 | if ($this instanceof File) { |
| 993 | 993 | $current = $this->version; |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | * |
| 1142 | 1142 | * @return ObjectId|string |
| 1143 | 1143 | */ |
| 1144 | - public function getId(bool $string=false) |
|
| 1144 | + public function getId(bool $string = false) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | if ($string === true) { |
| 1147 | 1147 | return (string)$this->_id; |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | * |
| 1157 | 1157 | * @return Collection |
| 1158 | 1158 | */ |
| 1159 | - public function getParent(): ?Collection |
|
| 1159 | + public function getParent(): ? Collection |
|
| 1160 | 1160 | { |
| 1161 | 1161 | try { |
| 1162 | 1162 | if ($this->isRoot()) { |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | * @param array $parents |
| 1192 | 1192 | * @return array |
| 1193 | 1193 | */ |
| 1194 | - public function getParents(?INode $node=null, array $parents=[]): array |
|
| 1194 | + public function getParents(? INode $node = null, array $parents = []) : array |
|
| 1195 | 1195 | { |
| 1196 | 1196 | if ($node === null) { |
| 1197 | 1197 | $node = $this; |
@@ -1258,7 +1258,7 @@ discard block |
||
| 1258 | 1258 | * @param int $depth |
| 1259 | 1259 | * @return bool |
| 1260 | 1260 | */ |
| 1261 | - public function zip(ZipStream $archive, bool $self=true, ?INode $parent=null, string $path='', int $depth=0): bool |
|
| 1261 | + public function zip(ZipStream $archive, bool $self = true, ? INode $parent = null, string $path = '', int $depth = 0) : bool |
|
| 1262 | 1262 | { |
| 1263 | 1263 | if ($parent === null) { |
| 1264 | 1264 | $parent = $this; |
@@ -1320,7 +1320,7 @@ discard block |
||
| 1320 | 1320 | * @param mixed $value |
| 1321 | 1321 | * @return INode |
| 1322 | 1322 | */ |
| 1323 | - public function setMetaAttribute($attributes, $value=null): INode |
|
| 1323 | + public function setMetaAttribute($attributes, $value = null): INode |
|
| 1324 | 1324 | { |
| 1325 | 1325 | $this->meta = self::validateMetaAttribute($attributes, $value, $this->meta); |
| 1326 | 1326 | $this->save('meta'); |
@@ -1336,7 +1336,7 @@ discard block |
||
| 1336 | 1336 | * @param array $set |
| 1337 | 1337 | * @return array |
| 1338 | 1338 | */ |
| 1339 | - public static function validateMetaAttribute($attributes, $value=null, array $set=[]): array |
|
| 1339 | + public static function validateMetaAttribute($attributes, $value = null, array $set = []): array |
|
| 1340 | 1340 | { |
| 1341 | 1341 | if (is_string($attributes)) { |
| 1342 | 1342 | $attributes = [ |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | * @param string|array $attribute Specify attributes to return |
| 1368 | 1368 | * @return string|array |
| 1369 | 1369 | */ |
| 1370 | - public function getMetaAttribute($attribute=[]) |
|
| 1370 | + public function getMetaAttribute($attribute = []) |
|
| 1371 | 1371 | { |
| 1372 | 1372 | if (is_string($attribute)) { |
| 1373 | 1373 | if (isset($this->meta[$attribute])) { |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | * @param bool $readonly |
| 1388 | 1388 | * @return bool |
| 1389 | 1389 | */ |
| 1390 | - public function setReadonly(bool $readonly=true): bool |
|
| 1390 | + public function setReadonly(bool $readonly = true): bool |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $this->readonly = $readonly; |
| 1393 | 1393 | return $this->save('readonly'); |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | * @param UTCDateTime $ts |
| 1401 | 1401 | * @return bool |
| 1402 | 1402 | */ |
| 1403 | - public function setDestroyable(?UTCDateTime $ts): bool |
|
| 1403 | + public function setDestroyable(? UTCDateTime $ts) : bool |
|
| 1404 | 1404 | { |
| 1405 | 1405 | $this->destroy = $ts; |
| 1406 | 1406 | |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | * @param string $recursion |
| 1424 | 1424 | * @return bool |
| 1425 | 1425 | */ |
| 1426 | - abstract public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool; |
|
| 1426 | + abstract public function delete(bool $force = false, ? string $recursion = null, bool $recursion_first = true) : bool; |
|
| 1427 | 1427 | |
| 1428 | 1428 | |
| 1429 | 1429 | /** |
@@ -1493,7 +1493,7 @@ discard block |
||
| 1493 | 1493 | * @param bool $recursion_first |
| 1494 | 1494 | * @return bool |
| 1495 | 1495 | */ |
| 1496 | - public function save($attributes=[], $remove=[], ?string $recursion=null, bool $recursion_first=true): bool |
|
| 1496 | + public function save($attributes = [], $remove = [], ? string $recursion = null, bool $recursion_first = true) : bool |
|
| 1497 | 1497 | { |
| 1498 | 1498 | if (!$this->isAllowed('w') && !$this->isReference()) { |
| 1499 | 1499 | throw new Exception\Forbidden('not allowed to modify node '.$this->name, |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | if (empty($update)) { |
| 1527 | 1527 | return false; |
| 1528 | 1528 | } else { |
| 1529 | - $result =$this->_db->storage->updateOne([ |
|
| 1529 | + $result = $this->_db->storage->updateOne([ |
|
| 1530 | 1530 | '_id' => $this->_id, |
| 1531 | 1531 | ], $update); |
| 1532 | 1532 | } |
@@ -1562,11 +1562,11 @@ discard block |
||
| 1562 | 1562 | * @return array |
| 1563 | 1563 | */ |
| 1564 | 1564 | public static function loadNodeAttributesWithCustomFilter( |
| 1565 | - ?array $filter = null, |
|
| 1565 | + ? array $filter = null, |
|
| 1566 | 1566 | array $attributes = ['_id'], |
| 1567 | - ?int $limit = null, |
|
| 1568 | - ?int &$cursor = null, |
|
| 1569 | - ?bool &$has_more = null) |
|
| 1567 | + ? int $limit = null, |
|
| 1568 | + ? int&$cursor = null, |
|
| 1569 | + ? bool&$has_more = null) |
|
| 1570 | 1570 | { |
| 1571 | 1571 | $default = [ |
| 1572 | 1572 | '_id' => 1, |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | |
| 1579 | 1579 | $search_attributes = array_merge($default, array_fill_keys($attributes, 1)); |
| 1580 | 1580 | $list = []; |
| 1581 | - $result =$this->_db->storage->find($filter, [ |
|
| 1581 | + $result = $this->_db->storage->find($filter, [ |
|
| 1582 | 1582 | 'skip' => $cursor, |
| 1583 | 1583 | 'limit' => $limit, |
| 1584 | 1584 | 'projection'=> $search_attributes |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Convert UTCDateTime to unix ts |
| 48 | 48 | * |
| 49 | 49 | * @param UTCDateTime $date |
| 50 | - * @return StdClass |
|
| 50 | + * @return null|\stdClass |
|
| 51 | 51 | */ |
| 52 | 52 | public static function DateTimeToUnix(?UTCDateTime $date): ?Stdclass |
| 53 | 53 | { |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | /** |
| 67 | 67 | * Search array element |
| 68 | 68 | * |
| 69 | - * @param mixed $values |
|
| 70 | - * @param mixed $key |
|
| 69 | + * @param integer $value |
|
| 70 | + * @param string $key |
|
| 71 | 71 | * @param array $array |
| 72 | - * @return void |
|
| 72 | + * @return integer |
|
| 73 | 73 | */ |
| 74 | 74 | public static function searchArray($value, $key, array $array) |
| 75 | 75 | { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Filter data |
| 88 | 88 | * |
| 89 | 89 | * @param mixed $data |
| 90 | - * @return mixed |
|
| 90 | + * @return string |
|
| 91 | 91 | */ |
| 92 | 92 | public static function filter($data) |
| 93 | 93 | { |
@@ -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 |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param UTCDateTime $date |
| 50 | 50 | * @return StdClass |
| 51 | 51 | */ |
| 52 | - public static function DateTimeToUnix(?UTCDateTime $date): ?Stdclass |
|
| 52 | + public static function DateTimeToUnix(? UTCDateTime $date) : ? Stdclass |
|
| 53 | 53 | { |
| 54 | 54 | if ($date === null) { |
| 55 | 55 | return null; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public static function isValidTimeStamp(string $timestamp): bool |
| 149 | 149 | { |
| 150 | - return ((string) (int) $timestamp === $timestamp) |
|
| 150 | + return ((string)(int)$timestamp === $timestamp) |
|
| 151 | 151 | && ($timestamp <= PHP_INT_MAX) |
| 152 | 152 | && ($timestamp >= ~PHP_INT_MAX); |
| 153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * Get body |
| 171 | 171 | * |
| 172 | - * @return mixed |
|
| 172 | + * @return string |
|
| 173 | 173 | */ |
| 174 | 174 | public function getBody() |
| 175 | 175 | { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param mixed $data |
| 288 | 288 | * @param SimpleXMLElement $xml |
| 289 | - * @param string|int $child_name |
|
| 289 | + * @param string $child_name |
|
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | 292 | public function toXML($data, SimpleXMLElement $xml, $child_name): string |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | /** |
| 354 | 354 | * Set the current output format. |
| 355 | 355 | * |
| 356 | - * @param string $foramt a key of $outputForms |
|
| 356 | + * @param string $format a key of $outputForms |
|
| 357 | 357 | * @return Response |
| 358 | 358 | */ |
| 359 | 359 | public function setOutputFormat(string $format): Response |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | use Balloon\Http; |
| 15 | 15 | use Balloon\Exception; |
| 16 | -use Balloon\Config\Xml; |
|
| 17 | 16 | use \SimpleXMLElement; |
| 18 | 17 | |
| 19 | 18 | class Response |
@@ -282,13 +282,13 @@ |
||
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * Converts mixed data to XML |
|
| 286 | - * |
|
| 287 | - * @param mixed $data |
|
| 288 | - * @param SimpleXMLElement $xml |
|
| 289 | - * @param string|int $child_name |
|
| 290 | - * @return string |
|
| 291 | - */ |
|
| 285 | + * Converts mixed data to XML |
|
| 286 | + * |
|
| 287 | + * @param mixed $data |
|
| 288 | + * @param SimpleXMLElement $xml |
|
| 289 | + * @param string|int $child_name |
|
| 290 | + * @return string |
|
| 291 | + */ |
|
| 292 | 292 | public function toXML($data, SimpleXMLElement $xml, $child_name): string |
| 293 | 293 | { |
| 294 | 294 | if (is_object($data)) { |
@@ -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 |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param bool $body_only |
| 159 | 159 | * @return Response |
| 160 | 160 | */ |
| 161 | - public function setBody($body, bool $body_only=false): Response |
|
| 161 | + public function setBody($body, bool $body_only = false): Response |
|
| 162 | 162 | { |
| 163 | 163 | $this->body = $body; |
| 164 | 164 | $this->body_only = $body_only; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $this->sendHeaders(); |
| 188 | 188 | $status = Http::STATUS_CODES[$this->code]; |
| 189 | - header('HTTP/1.0 ' . $this->code . ' ' . $status, true, $this->code); |
|
| 189 | + header('HTTP/1.0 '.$this->code.' '.$status, true, $this->code); |
|
| 190 | 190 | |
| 191 | 191 | if ($this->body === null && $this->code == 204) { |
| 192 | 192 | $this->terminate(); |
@@ -304,7 +304,7 @@ |
||
| 304 | 304 | * @param string $class |
| 305 | 305 | * @param string $method |
| 306 | 306 | * @param array $parsed_params |
| 307 | - * @return array |
|
| 307 | + * @return callable |
|
| 308 | 308 | */ |
| 309 | 309 | protected function getParams(string $class, string $method, array $parsed_params): array |
| 310 | 310 | { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } else { |
| 225 | 225 | $this->logger->debug('requested path ['.$this->path.'] does not match route ['.$route->getPath().']', [ |
| 226 | - 'category' => get_class($this), |
|
| 226 | + 'category' => get_class($this), |
|
| 227 | 227 | ]); |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -267,22 +267,22 @@ discard block |
||
| 267 | 267 | ]; |
| 268 | 268 | |
| 269 | 269 | switch (get_class($exception)) { |
| 270 | - case 'Balloon\\Exception\\InvalidArgument': |
|
| 270 | + case 'Balloon\\Exception\\InvalidArgument': |
|
| 271 | 271 | case 'Balloon\\Exception\\Conflict': |
| 272 | 272 | $code = 400; |
| 273 | - break; |
|
| 274 | - case 'Balloon\\Exception\\NotFound': |
|
| 273 | + break; |
|
| 274 | + case 'Balloon\\Exception\\NotFound': |
|
| 275 | 275 | $code = 404; |
| 276 | - break; |
|
| 277 | - case 'Balloon\\Exception\\Forbidden': |
|
| 276 | + break; |
|
| 277 | + case 'Balloon\\Exception\\Forbidden': |
|
| 278 | 278 | $code = 403; |
| 279 | - break; |
|
| 280 | - case 'Balloon\\Exception\\InsufficientStorage': |
|
| 279 | + break; |
|
| 280 | + case 'Balloon\\Exception\\InsufficientStorage': |
|
| 281 | 281 | $code = 507; |
| 282 | - break; |
|
| 283 | - default: |
|
| 282 | + break; |
|
| 283 | + default: |
|
| 284 | 284 | $code = 500; |
| 285 | - break; |
|
| 285 | + break; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $this->logger->error('uncaught exception '.$message.']', [ |
@@ -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 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | * @param string|object $class |
| 72 | 72 | * @param string $method |
| 73 | 73 | * @param array $params |
| 74 | - * @return void |
|
| 74 | + * @return Route |
|
| 75 | 75 | */ |
| 76 | 76 | public function __construct(string $path, $class, ?string $method=null, array $params=[]) |
| 77 | 77 | { |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace Balloon\Http\Router; |
| 13 | 13 | |
| 14 | -use Balloon\Exception; |
|
| 15 | 14 | use Balloon\Http\Router; |
| 16 | 15 | |
| 17 | 16 | class Route |
@@ -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 array $params |
| 74 | 74 | * @return void |
| 75 | 75 | */ |
| 76 | - public function __construct(string $path, $class, ?string $method=null, array $params=[]) |
|
| 76 | + public function __construct(string $path, $class, ? string $method = null, array $params = []) |
|
| 77 | 77 | { |
| 78 | 78 | $this->setPath($path); |
| 79 | 79 | $this->setClass($class); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function match(): bool |
| 91 | 91 | { |
| 92 | - $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function ($match) { |
|
| 92 | + $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function($match) { |
|
| 93 | 93 | if (count($match) === 4) { |
| 94 | 94 | return '(?<'.$match[2].'>'.$match[3].'+)'; |
| 95 | 95 | } else { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param array $constructor |
| 119 | 119 | * @return array |
| 120 | 120 | */ |
| 121 | - public function getCallable($constructor=[]): array |
|
| 121 | + public function getCallable($constructor = []): array |
|
| 122 | 122 | { |
| 123 | 123 | if (is_object($this->class)) { |
| 124 | 124 | $instance = $this->class; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string $name |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - protected function _buildMethodName(?string $name): string |
|
| 143 | + protected function _buildMethodName(? string $name) : string |
|
| 144 | 144 | { |
| 145 | 145 | $result = $this->router->getVerb(); |
| 146 | 146 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @param string $method |
| 266 | 266 | * @return Route |
| 267 | 267 | */ |
| 268 | - public function setMethod(?string $method): Route |
|
| 268 | + public function setMethod(? string $method) : Route |
|
| 269 | 269 | { |
| 270 | 270 | $this->method = $method; |
| 271 | 271 | return $this; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @param bool $next |
| 314 | 314 | * @return Route |
| 315 | 315 | */ |
| 316 | - public function continuePropagation($next=true): Route |
|
| 316 | + public function continuePropagation($next = true): Route |
|
| 317 | 317 | { |
| 318 | 318 | $this->continue_propagation = (bool)$next; |
| 319 | 319 | return $this; |
@@ -49,7 +49,6 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * Create adapter |
| 51 | 51 | * |
| 52 | - * @param Iterable $options |
|
| 53 | 52 | * @return void |
| 54 | 53 | */ |
| 55 | 54 | public function __construct(?Iterable $config=null) |
@@ -92,7 +91,6 @@ discard block |
||
| 92 | 91 | /** |
| 93 | 92 | * Set options |
| 94 | 93 | * |
| 95 | - * @param Iterable $options |
|
| 96 | 94 | * @return AdapterInterface |
| 97 | 95 | */ |
| 98 | 96 | public function setOptions(?Iterable $config=null): AdapterInterface |
@@ -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 |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param Iterable $options |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - public function __construct(?Iterable $config=null) |
|
| 55 | + public function __construct(? Iterable $config = null) |
|
| 56 | 56 | { |
| 57 | 57 | $this->setOptions($config); |
| 58 | 58 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param Iterable $options |
| 96 | 96 | * @return AdapterInterface |
| 97 | 97 | */ |
| 98 | - public function setOptions(?Iterable $config=null): AdapterInterface |
|
| 98 | + public function setOptions(? Iterable $config = null) : AdapterInterface |
|
| 99 | 99 | { |
| 100 | 100 | if ($config === null) { |
| 101 | 101 | return $this; |
@@ -27,7 +27,6 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * Create adapter |
| 29 | 29 | * |
| 30 | - * @param Iterable $options |
|
| 31 | 30 | * @return void |
| 32 | 31 | */ |
| 33 | 32 | public function __construct(?Iterable $config=null); |
@@ -58,7 +57,6 @@ discard block |
||
| 58 | 57 | /** |
| 59 | 58 | * Set options |
| 60 | 59 | * |
| 61 | - * @param Iterable $options |
|
| 62 | 60 | * @return AdapterInterface |
| 63 | 61 | */ |
| 64 | 62 | public function setOptions(?Iterable $config=null): AdapterInterface; |
@@ -11,8 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace Balloon\Log\Adapter; |
| 13 | 13 | |
| 14 | -use Balloon\Exception; |
|
| 15 | - |
|
| 16 | 14 | interface AdapterInterface |
| 17 | 15 | { |
| 18 | 16 | /** |
@@ -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 |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param Iterable $options |
| 31 | 31 | * @return void |
| 32 | 32 | */ |
| 33 | - public function __construct(?Iterable $config=null); |
|
| 33 | + public function __construct(? Iterable $config = null); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -61,5 +61,5 @@ discard block |
||
| 61 | 61 | * @param Iterable $options |
| 62 | 62 | * @return AdapterInterface |
| 63 | 63 | */ |
| 64 | - public function setOptions(?Iterable $config=null): AdapterInterface; |
|
| 64 | + public function setOptions(? Iterable $config = null) : AdapterInterface; |
|
| 65 | 65 | } |