Completed
Branch dev (9b7350)
by Raffael
07:13
created
src/app/Balloon.App.ClamAv/Hook.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,6 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/app/Balloon.App.ClamAv/Job.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,6 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/app/Balloon.App.ClamAv/Scanner.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,6 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/app/Balloon.App.Convert/Job.php 2 patches
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
57 56
     /**
58 57
      * Start job.
59 58
      *
60
-     * @param Server          $server
61
-     * @param LoggerInterface $logger
62 59
      *
63 60
      * @return bool
64 61
      */
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/app/Balloon.App.Elasticsearch/Elasticsearch.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     /**
205 205
      * Get es client.
206 206
      *
207
-     * @return Elasticsearch
207
+     * @return Client
208 208
      */
209 209
     protected function getEsClient(): Client
210 210
     {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * Search.
222 222
      *
223 223
      * @param array $query
224
-     * @param array $share
224
+     * @param array $shares
225 225
      *
226 226
      * @return array
227 227
      */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return Elasticsearch
87 87
      */
88
-    public function setOptions(?Iterable $config = null): self
88
+    public function setOptions(?Iterable $config = null) : self
89 89
     {
90 90
         if (null === $config) {
91 91
             return $this;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         foreach ($config as $option => $value) {
95 95
             switch ($option) {
96 96
                 case 'server':
97
-                    $this->es_server = (array) $value;
97
+                    $this->es_server = (array)$value;
98 98
 
99 99
                 break;
100 100
                 case 'index':
101
-                    $this->es_index = (string) $value;
101
+                    $this->es_index = (string)$value;
102 102
 
103 103
                 break;
104 104
                 default:
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             ],
149 149
         ]);
150 150
 
151
-        $user = (string) $this->user->getId();
151
+        $user = (string)$this->user->getId();
152 152
         foreach ($result['hits']['hits'] as $node) {
153 153
             $id = false;
154 154
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                     $_node = $this->fs->findNodeWithId($id);
160 160
                     if ($_node->isDeleted() && (1 === $deleted || 2 === $deleted)
161 161
                      || !$_node->isDeleted() && (0 === $deleted || 2 === $deleted)) {
162
-                        if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string) $_node->getId()])) {
163
-                            $list[(string) $_node->getId()] = $_node;
162
+                        if (!($_node->isShared() && !$_node->isOwnerRequest()) && !isset($list[(string)$_node->getId()])) {
163
+                            $list[(string)$_node->getId()] = $_node;
164 164
                         }
165 165
                     }
166 166
                 } catch (\Exception $e) {
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
         $bool = $query['body']['query'];
231 231
 
232 232
         $filter1 = [];
233
-        $filter1['bool']['should'][]['term']['owner'] = (string) $this->user->getId();
234
-        $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string) $this->user->getId();
233
+        $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId();
234
+        $filter1['bool']['should'][]['term']['metadata.ref.owner'] = (string)$this->user->getId();
235 235
 
236 236
         $share_filter = [
237 237
             'bool' => [
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/App/Http.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,7 @@
 block discarded – undo
22 22
     /**
23 23
      * Constructor.
24 24
      *
25
-     * @param LoggerInterace $logger
26 25
      * @param Router         $router
27
-     * @param iterable       $config
28 26
      */
29 27
     public function __construct(Router $router)
30 28
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Hook/NewShareAdded.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * Constructor.
65 65
      *
66
-     * @param Notification $notifier
66
+     * @param Notifier $notifier
67 67
      * @param Server       $server
68 68
      */
69 69
     public function __construct(Notifier $notifier, Server $server, LoggerInterface $logger, ?Iterable $config = null)
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @param NodeInterface $node
161 161
      * @param User          $user
162 162
      *
163
-     * @return string
163
+     * @return boolean
164 164
      */
165 165
     protected function checkNotify(NodeInterface $node, User $user): bool
166 166
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,23 +130,23 @@  discard block
 block discarded – undo
130 130
         foreach ($node->getShareAcl() 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) use ($node) {
146
+            $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($node) {
147 147
                 return $node->getAttribute($match[2]);
148 148
             }, $this->body);
149
-            $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($node) {
149
+            $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($node) {
150 150
                 return $node->getAttribute($match[2]);
151 151
             }, $this->subject);
152 152
 
Please login to merge, or discard this patch.
src/app/Balloon.App.Notification/Notifier.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * Constructor.
74 74
      *
75 75
      * @param Database $db
76
-     * @param LoggerInterace $logger
76
+     * @param LoggerInterface $logger
77 77
      * @param iterable       $config
78 78
      */
79 79
     public function __construct(Database $db, LoggerInterface $logger, ?Iterable $config = null)
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      *
172 172
      * @param AdapterInterface $adapter
173 173
      *
174
-     * @return AdapterInterface
174
+     * @return Notifier
175 175
      */
176 176
     public function injectAdapter($adapter, ?string $name = null): AdapterAwareInterface
177 177
     {
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
      * Add notification
242 242
      *
243 243
      * @param array $receiver
244
-     * @param User $user
245 244
      * @param string $subject
246 245
      * @param string $body
247 246
      * @param array $context
247
+     * @param User $sender
248 248
      * @return ObjectId
249 249
      */
250 250
     public function postNotification(array $receiver, ?User $sender, string $subject, string $body, array $context = []): ObjectId
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return Notifier
92 92
      */
93
-    public function setOptions(?Iterable $config = null): self
93
+    public function setOptions(?Iterable $config = null) : self
94 94
     {
95 95
         if (null === $config) {
96 96
             return $this;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return bool
135 135
      */
136
-    public function notify(array $receiver, ?User $sender, string $subject, string $body, array $context = []): bool
136
+    public function notify(array $receiver, ?User $sender, string $subject, string $body, array $context = []) : bool
137 137
     {
138 138
         if (0 === count($this->adapter)) {
139 139
             $this->logger->warning('there are no notification adapter enabled, notification can not be sent', [
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @return AdapterInterface
175 175
      */
176
-    public function injectAdapter($adapter, ?string $name = null): AdapterAwareInterface
176
+    public function injectAdapter($adapter, ?string $name = null) : AdapterAwareInterface
177 177
     {
178 178
         if (!($adapter instanceof AdapterInterface)) {
179 179
             throw new Exception('adapter needs to implement AdapterInterface');
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param array $context
248 248
      * @return ObjectId
249 249
      */
250
-    public function postNotification(array $receiver, ?User $sender, string $subject, string $body, array $context = []): ObjectId
250
+    public function postNotification(array $receiver, ?User $sender, string $subject, string $body, array $context = []) : ObjectId
251 251
     {
252 252
         $data = [
253 253
             'subject' => $subject,
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
             'receiver' => [],
257 257
         ];
258 258
 
259
-        if($sender instanceof User) {
259
+        if ($sender instanceof User) {
260 260
             $data['sender'] = $sender->getId();
261 261
         }
262 262
 
263
-        foreach($receiver as $user) {
263
+        foreach ($receiver as $user) {
264 264
             $data['receiver'][] = $user->getId();
265 265
         }
266 266
 
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
             'receiver' => $user->getId()
297 297
         ]);
298 298
 
299
-        if($result === null) {
299
+        if ($result === null) {
300 300
             throw new Exception('notification not found');
301 301
         }
302 302
 
303
-        if(count($result['receiver']) <= 1) {
303
+        if (count($result['receiver']) <= 1) {
304 304
             $this->logger->debug('notification ['.$id.'] has only one member left, remove it', [
305 305
                 'category' => get_class($this)
306 306
             ]);
Please login to merge, or discard this patch.
src/app/Balloon.App.Office/Api/v1/Document.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.