@@ -28,7 +28,6 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Constructor. |
| 30 | 30 | * |
| 31 | - * @param App $app |
|
| 32 | 31 | * @param Async $async |
| 33 | 32 | */ |
| 34 | 33 | public function __construct(Async $async) |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |
@@ -35,7 +35,6 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * Constructor. |
| 37 | 37 | * |
| 38 | - * @param App $app |
|
| 39 | 38 | * @param Server $server |
| 40 | 39 | */ |
| 41 | 40 | public function __construct(Scanner $scanner, Server $server) |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |
@@ -79,7 +79,6 @@ |
||
| 79 | 79 | /** |
| 80 | 80 | * Constructor. |
| 81 | 81 | * |
| 82 | - * @param Database $db |
|
| 83 | 82 | * @param LoggerInterface $logger |
| 84 | 83 | */ |
| 85 | 84 | public function __construct(SocketFactory $factory, LoggerInterface $logger, ?Iterable $config = null) |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return Scanner |
| 98 | 98 | */ |
| 99 | - public function setOptions(?Iterable $config = null): self |
|
| 99 | + public function setOptions(?Iterable $config = null) : self |
|
| 100 | 100 | { |
| 101 | 101 | if (null === $config) { |
| 102 | 102 | return $this; |
@@ -105,22 +105,22 @@ discard block |
||
| 105 | 105 | foreach ($config as $option => $value) { |
| 106 | 106 | switch ($option) { |
| 107 | 107 | case 'socket': |
| 108 | - $this->socket = (string) $value; |
|
| 108 | + $this->socket = (string)$value; |
|
| 109 | 109 | |
| 110 | 110 | break; |
| 111 | 111 | case 'max_stream_size': |
| 112 | - $this->max_stream_size = (int) $value; |
|
| 112 | + $this->max_stream_size = (int)$value; |
|
| 113 | 113 | |
| 114 | 114 | break; |
| 115 | 115 | case 'aggressiveness': |
| 116 | - if ((int) $value > 3 || (int) $value < 0) { |
|
| 117 | - throw new Exception('invalid config value ['.(int) $value.'] for aggressiveness'); |
|
| 116 | + if ((int)$value > 3 || (int)$value < 0) { |
|
| 117 | + throw new Exception('invalid config value ['.(int)$value.'] for aggressiveness'); |
|
| 118 | 118 | } |
| 119 | - $this->aggressiveness = (int) $value; |
|
| 119 | + $this->aggressiveness = (int)$value; |
|
| 120 | 120 | |
| 121 | 121 | break; |
| 122 | 122 | case 'timeout': |
| 123 | - $this->timeout = (int) $value; |
|
| 123 | + $this->timeout = (int)$value; |
|
| 124 | 124 | |
| 125 | 125 | break; |
| 126 | 126 | break; |
@@ -45,7 +45,6 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * Constructor. |
| 47 | 47 | * |
| 48 | - * @param Async $async |
|
| 49 | 48 | */ |
| 50 | 49 | public function __construct(Converter $converter, Server $server, LoggerInterface $logger) |
| 51 | 50 | { |
@@ -57,8 +56,6 @@ discard block |
||
| 57 | 56 | /** |
| 58 | 57 | * Start job. |
| 59 | 58 | * |
| 60 | - * @param Server $server |
|
| 61 | - * @param LoggerInterface $logger |
|
| 62 | 59 | * |
| 63 | 60 | * @return bool |
| 64 | 61 | */ |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $slaves = $file->getAppAttribute(__NAMESPACE__, 'slaves'); |
| 74 | 74 | |
| 75 | - if (is_array($slaves) && isset($slaves[(string) $this->data['slave']])) { |
|
| 76 | - $slave = $slaves[(string) $this->data['slave']]; |
|
| 75 | + if (is_array($slaves) && isset($slaves[(string)$this->data['slave']])) { |
|
| 76 | + $slave = $slaves[(string)$this->data['slave']]; |
|
| 77 | 77 | } else { |
| 78 | 78 | throw new Exception('unknown slave node'); |
| 79 | 79 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $node->setReadonly(); |
| 123 | 123 | |
| 124 | - $slaves[(string) $this->data['slave']]['node'] = $node->getId(); |
|
| 124 | + $slaves[(string)$this->data['slave']]['node'] = $node->getId(); |
|
| 125 | 125 | $file->setAppAttribute(__NAMESPACE__, 'slaves', $slaves); |
| 126 | 126 | |
| 127 | 127 | return true; |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | use Balloon\App\Notification\Exception; |
| 16 | 16 | use Balloon\App\Notification\Notifier; |
| 17 | -use Balloon\Async\Mail; |
|
| 18 | 17 | use Balloon\Filesystem\Node\Collection; |
| 19 | 18 | use Balloon\Filesystem\Node\NodeInterface; |
| 20 | 19 | use Balloon\Hook\AbstractHook; |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | * @param NodeInterface $node |
| 163 | 163 | * @param User $user |
| 164 | 164 | * |
| 165 | - * @return string |
|
| 165 | + * @return boolean |
|
| 166 | 166 | */ |
| 167 | 167 | protected function checkNotify(NodeInterface $node, User $user): bool |
| 168 | 168 | { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return AbstractHook |
| 83 | 83 | */ |
| 84 | - public function setOptions(?Iterable $config = null): AbstractHook |
|
| 84 | + public function setOptions(?Iterable $config = null) : AbstractHook |
|
| 85 | 85 | { |
| 86 | 86 | if (null === $config) { |
| 87 | 87 | return $this; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | switch ($option) { |
| 92 | 92 | case 'body': |
| 93 | 93 | case 'subject': |
| 94 | - $this->{$option} = (string) $value; |
|
| 94 | + $this->{$option} = (string)$value; |
|
| 95 | 95 | |
| 96 | 96 | break; |
| 97 | 97 | default: |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param string $recursion |
| 114 | 114 | * @param bool $recursion_first |
| 115 | 115 | */ |
| 116 | - public function postSaveNodeAttributes(NodeInterface $node, array $attributes, array $remove, ?string $recursion, bool $recursion_first): void |
|
| 116 | + public function postSaveNodeAttributes(NodeInterface $node, array $attributes, array $remove, ?string $recursion, bool $recursion_first) : void |
|
| 117 | 117 | { |
| 118 | 118 | if (!($node instanceof Collection)) { |
| 119 | 119 | return; |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | foreach ($node->getAcl() as $rule) { |
| 131 | 131 | if ('user' === $rule['type']) { |
| 132 | 132 | $user = $this->server->getUserById(new ObjectId($rule['id'])); |
| 133 | - if (!isset($receiver[(string) $user->getId()]) && $this->checkNotify($node, $user)) { |
|
| 134 | - $receiver[(string) $user->getId()] = $user; |
|
| 133 | + if (!isset($receiver[(string)$user->getId()]) && $this->checkNotify($node, $user)) { |
|
| 134 | + $receiver[(string)$user->getId()] = $user; |
|
| 135 | 135 | } |
| 136 | 136 | } elseif ('group' === $rule['type']) { |
| 137 | 137 | foreach ($this->server->getGroupById($rule['id'])->getResolvedMember() as $user) { |
| 138 | - if (!isset($receiver[(string) $user->getId()]) && $this->checkNotify($node, $user)) { |
|
| 139 | - $receiver[(string) $user->getId()] = $user; |
|
| 138 | + if (!isset($receiver[(string)$user->getId()]) && $this->checkNotify($node, $user)) { |
|
| 139 | + $receiver[(string)$user->getId()] = $user; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (!empty($receiver)) { |
| 146 | - $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) { |
|
| 146 | + $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) { |
|
| 147 | 147 | return ''; |
| 148 | 148 | //return $node->getAttributes()[$match[2]]; |
| 149 | 149 | }, $this->body); |
| 150 | - $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) { |
|
| 150 | + $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) { |
|
| 151 | 151 | return ''; |
| 152 | 152 | //return $node->getAttributes()[$match[2]]; |
| 153 | 153 | }, $this->subject); |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Balloon\Filesystem\Node\Collection; |
| 21 | 21 | use Balloon\Filesystem\Node\File; |
| 22 | 22 | use Balloon\Server; |
| 23 | -use Balloon\Server\User; |
|
| 24 | 23 | use Micro\Http\Response; |
| 25 | 24 | |
| 26 | 25 | class Document extends Controller |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Balloon |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return Response |
| 88 | 88 | */ |
| 89 | - public function get(?string $id = null, ?string $p = null): Response |
|
| 89 | + public function get(?string $id = null, ?string $p = null) : Response |
|
| 90 | 90 | { |
| 91 | 91 | $node = $this->fs->getNode($id, $p, File::class); |
| 92 | 92 | $document = new OfficeDoc($this->fs->getDatabase(), $node); |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | foreach ($document->getSessions() as $session) { |
| 96 | 96 | $sessions[] = [ |
| 97 | - 'id' => (string) $session['_id'], |
|
| 97 | + 'id' => (string)$session['_id'], |
|
| 98 | 98 | 'created' => $session['_id']->getTimestamp(), |
| 99 | 99 | 'user' => [ |
| 100 | - 'id' => (string) $session['user'], |
|
| 100 | + 'id' => (string)$session['user'], |
|
| 101 | 101 | 'name' => $this->server->getUserById($session['user'])->getUsername(), |
| 102 | 102 | ], |
| 103 | 103 | ]; |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return Response |
| 160 | 160 | */ |
| 161 | - public function put(string $name, string $type, ?string $collection = null, array $attributes = [], int $conflict = 0): Response |
|
| 161 | + public function put(string $name, string $type, ?string $collection = null, array $attributes = [], int $conflict = 0) : Response |
|
| 162 | 162 | { |
| 163 | 163 | $parent = $this->fs->getNode($collection, null, Collection::class, false, true); |
| 164 | 164 | $tpl = new Template($type); |
| 165 | 165 | $result = $parent->addFile($name, $tpl->get(), $attributes); |
| 166 | 166 | |
| 167 | - return (new Response())->setCode(201)->setBody((string) $result->getId()); |
|
| 167 | + return (new Response())->setCode(201)->setBody((string)$result->getId()); |
|
| 168 | 168 | } |
| 169 | 169 | } |
@@ -151,7 +151,6 @@ |
||
| 151 | 151 | * Get by access token. |
| 152 | 152 | * |
| 153 | 153 | * @param string $id |
| 154 | - * @param string $access_token |
|
| 155 | 154 | * |
| 156 | 155 | * @return Session |
| 157 | 156 | */ |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * @param ObjectId $session_id |
| 149 | 149 | * @param string $access_token |
| 150 | 150 | * |
| 151 | - * @return Session |
|
| 151 | + * @return Session|null |
|
| 152 | 152 | */ |
| 153 | 153 | public static function getByAccessToken(Server $server, ObjectId $session_id, string $access_token): self |
| 154 | 154 | { |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |
@@ -35,7 +35,6 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * Constructor. |
| 37 | 37 | * |
| 38 | - * @param App $app |
|
| 39 | 38 | * @param Server $server |
| 40 | 39 | */ |
| 41 | 40 | public function __construct(PreviewCreator $preview, Server $server) |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Balloon |