Completed
Pull Request — master (#137)
by Raffael
09:31
created
src/app/Balloon.App.Office/Api/v2/Documents.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
         $tpl = new Template($type);
174 174
 
175 175
         $attributes = compact('readonly', 'meta');
176
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
176
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
177 177
 
178 178
         $result = $parent->addFile($name, $tpl->get(), $attributes);
179 179
         $result = $this->decorator->decorate($result);
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Files.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
             try {
344 344
                 $attributes = compact('changed', 'created', 'readonly', 'meta');
345
-                $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
345
+                $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
346 346
                 $attributes = $this->_verifyAttributes($attributes);
347 347
 
348 348
                 return $this->_put($file, $id, $p, $collection, $name, $attributes, $conflict);
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         $content = fopen('php://input', 'rb');
464 464
 
465 465
         $attributes = compact('changed', 'created', 'readonly', 'meta');
466
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
466
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
467 467
         $attributes = $this->_verifyAttributes($attributes);
468 468
 
469 469
         return $this->_put($content, $id, $p, $collection, $name, $attributes, $conflict);
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
      *
116 116
      * @param string $id
117 117
      * @param string $p
118
-     * @param string $version
118
+     * @param integer $version
119 119
      */
120 120
     public function postRestore(int $version, ?string $id = null, ?string $p = null): Response
121 121
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Groups.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         }
271 271
 
272 272
         $attributes = compact('namespace', 'optional');
273
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
273
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
274 274
 
275 275
         $id = $this->server->addGroup($name, $member, $attributes);
276 276
         $result = $this->decorator->decorate($this->server->getGroupById($id));
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function patch(string $id, ?array $member = null, ?string $namespace = null, ?array $optional = null): Response
310 310
     {
311 311
         $attributes = compact('namespace', 'optional', 'name', 'member');
312
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
312
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
313 313
 
314 314
         $group = $this->_getGroup($id, true);
315 315
         $group->setAttributes($attributes);
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Users.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         }
389 389
 
390 390
         $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional');
391
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
391
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
392 392
 
393 393
         if (isset($attributes['avatar'])) {
394 394
             $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     public function patch(?string $id = null, ?string $uname = null, ?string $username = null, ?string $password = null, ?int $soft_quota = null, ?int $hard_quota = null, ?string $avatar = null, ?string $mail = null, ?bool $admin = false, ?string $namespace = null, ?string $locale = null, ?array $optional = null): Response
437 437
     {
438 438
         $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional');
439
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
439
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
440 440
 
441 441
         if (isset($attributes['avatar'])) {
442 442
             $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC);
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/AttributeDecorator/NodeDecorator.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
             'mime' => (string) $attributes['mime'],
142 142
             'readonly' => (bool) $attributes['readonly'],
143 143
             'directory' => $node instanceof Collection,
144
-            'meta' => function ($node) {
144
+            'meta' => function($node) {
145 145
                 return (object) $node->getMetaAttributes();
146 146
             },
147
-            'size' => function ($node) {
147
+            'size' => function($node) {
148 148
                 return $node->getSize();
149 149
             },
150
-            'path' => function ($node) {
150
+            'path' => function($node) {
151 151
                 try {
152 152
                     return $node->getPath();
153 153
                 } catch (\Exception $e) {
154 154
                     return null;
155 155
                 }
156 156
             },
157
-            'parent' => function ($node) {
157
+            'parent' => function($node) {
158 158
                 $id = $node->getAttributes()['parent'];
159 159
 
160 160
                 if (null === $id) {
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
                 return (string) $id;
165 165
             },
166
-            'access' => function ($node) use ($acl) {
166
+            'access' => function($node) use ($acl) {
167 167
                 return $acl->getAclPrivilege($node);
168 168
             },
169
-            'share' => function ($node) {
169
+            'share' => function($node) {
170 170
                 if ($node->isShared() || !$node->isSpecial()) {
171 171
                     return null;
172 172
                 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                     return null;
178 178
                 }
179 179
             },
180
-            'shareowner' => function ($node) use ($server, $fs) {
180
+            'shareowner' => function($node) use ($server, $fs) {
181 181
                 if (!$node->isSpecial()) {
182 182
                     return null;
183 183
                 }
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
     protected function getTimeAttributes(NodeInterface $node, array $attributes): array
224 224
     {
225 225
         return [
226
-            'created' => function ($node) use ($attributes) {
226
+            'created' => function($node) use ($attributes) {
227 227
                 return $this->dateTimeToUnix($attributes['created']);
228 228
             },
229
-            'changed' => function ($node) use ($attributes) {
229
+            'changed' => function($node) use ($attributes) {
230 230
                 return $this->dateTimeToUnix($attributes['changed']);
231 231
             },
232
-            'deleted' => function ($node) use ($attributes) {
232
+            'deleted' => function($node) use ($attributes) {
233 233
                 if (false === $attributes['deleted']) {
234 234
                     return false;
235 235
                 }
236 236
 
237 237
                 return $this->dateTimeToUnix($attributes['deleted']);
238 238
             },
239
-            'destroy' => function ($node) use ($attributes) {
239
+            'destroy' => function($node) use ($attributes) {
240 240
                 if (null === $attributes['destroy']) {
241 241
                     return null;
242 242
                 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
      * Add decorator.
87 87
      *
88 88
      *
89
-     * @return AttributeDecorator
89
+     * @return NodeDecorator
90 90
      */
91 91
     public function addDecorator(string $attribute, Closure $decorator): self
92 92
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/AttributeDecorator/RoleDecorator.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         return [
108
-            'created' => function ($role, $requested) use ($attributes) {
108
+            'created' => function($role, $requested) use ($attributes) {
109 109
                 return $attributes['created']->toDateTime()->format('c');
110 110
             },
111
-            'changed' => function ($role, $requested) use ($attributes) {
111
+            'changed' => function($role, $requested) use ($attributes) {
112 112
                 return $attributes['changed']->toDateTime()->format('c');
113 113
             },
114
-            'deleted' => function ($role, $requested) use ($attributes) {
114
+            'deleted' => function($role, $requested) use ($attributes) {
115 115
                 if (false === $attributes['deleted']) {
116 116
                     return null;
117 117
                 }
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
             'name' => (string) $attributes['username'],
165 165
             'namespace' => (string) $attributes['namespace'],
166 166
             'mail' => (string) $attributes['mail'],
167
-            'avatar' => function ($role, $requested) use ($attributes) {
167
+            'avatar' => function($role, $requested) use ($attributes) {
168 168
                 if ($attributes['avatar'] instanceof Binary) {
169 169
                     return base64_encode($attributes['avatar']->getData());
170 170
                 }
171 171
 
172 172
                 return null;
173 173
             },
174
-            'soft_quota' => function ($role, $requested) use ($attributes, $user) {
174
+            'soft_quota' => function($role, $requested) use ($attributes, $user) {
175 175
                 if ($user === null) {
176 176
                     return null;
177 177
                 }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
                 return null;
184 184
             },
185
-            'hard_quota' => function ($role, $requested) use ($attributes, $user) {
185
+            'hard_quota' => function($role, $requested) use ($attributes, $user) {
186 186
                 if ($user === null) {
187 187
                     return null;
188 188
                 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      * Add decorator.
74 74
      *
75 75
      *
76
-     * @return AttributeDecorator
76
+     * @return RoleDecorator
77 77
      */
78 78
     public function addDecorator(string $attribute, Closure $decorator): self
79 79
     {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v2/Nodes.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -273,37 +273,37 @@  discard block
 block discarded – undo
273 273
         }
274 274
 
275 275
         return $response
276
-          ->setOutputFormat(null)
277
-          ->setBody(function () use ($node, $offset, $limit) {
278
-              $stream = $node->get();
279
-              $name = $node->getName();
280
-
281
-              if (null === $stream) {
282
-                  return;
283
-              }
284
-
285
-              if (0 !== $offset) {
286
-                  if (fseek($stream, $offset) === -1) {
287
-                      throw new Exception\Conflict(
276
+            ->setOutputFormat(null)
277
+            ->setBody(function () use ($node, $offset, $limit) {
278
+                $stream = $node->get();
279
+                $name = $node->getName();
280
+
281
+                if (null === $stream) {
282
+                    return;
283
+                }
284
+
285
+                if (0 !== $offset) {
286
+                    if (fseek($stream, $offset) === -1) {
287
+                        throw new Exception\Conflict(
288 288
                         'invalid offset requested',
289 289
                         Exception\Conflict::INVALID_OFFSET
290 290
                     );
291
-                  }
292
-              }
293
-
294
-              $read = 0;
295
-              while (!feof($stream)) {
296
-                  if (0 !== $limit && $read + 8192 > $limit) {
297
-                      echo fread($stream, $limit - $read);
298
-                      exit();
299
-                  }
300
-
301
-                  echo fread($stream, 8192);
302
-                  $read += 8192;
303
-              }
304
-
305
-              exit();
306
-          });
291
+                    }
292
+                }
293
+
294
+                $read = 0;
295
+                while (!feof($stream)) {
296
+                    if (0 !== $limit && $read + 8192 > $limit) {
297
+                        echo fread($stream, $limit - $read);
298
+                        exit();
299
+                    }
300
+
301
+                    echo fread($stream, 8192);
302
+                    $read += 8192;
303
+                }
304
+
305
+                exit();
306
+            });
307 307
     }
308 308
 
309 309
     /**
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
                 $node->zip($archive);
1054 1054
             } catch (\Exception $e) {
1055 1055
                 $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [
1056
-                   'category' => get_class($this),
1057
-                   'exception' => $e,
1058
-               ]);
1056
+                    'category' => get_class($this),
1057
+                    'exception' => $e,
1058
+                ]);
1059 1059
             }
1060 1060
         }
1061 1061
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
         }
189 189
 
190
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) {
190
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) {
191 191
             if (true === $move) {
192 192
                 $node = $node->setParent($parent, $conflict);
193 193
             }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
         return $response
276 276
           ->setOutputFormat(null)
277
-          ->setBody(function () use ($node, $offset, $limit) {
277
+          ->setBody(function() use ($node, $offset, $limit) {
278 278
               $stream = $node->get();
279 279
               $name = $node->getName();
280 280
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             return (new Response())->setCode(200)->setBody($result);
411 411
         }
412 412
 
413
-        return $this->bulk($id, $p, function ($node) use ($attributes) {
413
+        return $this->bulk($id, $p, function($node) use ($attributes) {
414 414
             return [
415 415
                 'code' => 200,
416 416
                 'data' => $this->node_decorator->decorate($node, $attributes),
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
     public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?string $id = null, ?string $p = null): Response
525 525
     {
526 526
         $attributes = compact('name', 'meta', 'readonly', 'filter');
527
-        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); });
527
+        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); });
528 528
 
529
-        return $this->bulk($id, $p, function ($node) use ($attributes) {
529
+        return $this->bulk($id, $p, function($node) use ($attributes) {
530 530
             foreach ($attributes as $attribute => $value) {
531 531
                 switch ($attribute) {
532 532
                     case 'name':
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
             );
609 609
         }
610 610
 
611
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
611
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
612 612
             $result = $node->copyTo($parent, $conflict);
613 613
 
614 614
             return [
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
             );
673 673
         }
674 674
 
675
-        return $this->bulk($id, $p, function ($node) use ($parent, $conflict) {
675
+        return $this->bulk($id, $p, function($node) use ($parent, $conflict) {
676 676
             $result = $node->setParent($parent, $conflict);
677 677
 
678 678
             return [
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
             $at = $this->_verifyAttributes(['destroy' => $at])['destroy'];
727 727
         }
728 728
 
729
-        return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) {
729
+        return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) {
730 730
             if (null === $at) {
731 731
                 $node->delete($force && $node->isDeleted() || $force && $ignore_flag);
732 732
             } else {
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/Controller.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      * @param string $class      Force set node type
211 211
      * @param bool   $multiple   Allow $id to be an array
212 212
      * @param bool   $allow_root Allow instance of root collection
213
-     * @param bool   $deleted    How to handle deleted node
213
+     * @param integer   $deleted    How to handle deleted node
214 214
      */
215 215
     protected function _getNode(
216 216
         ?string $id = null,
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      * @param string $id
243 243
      * @param string $path
244 244
      * @param string $class   Force set node type
245
-     * @param bool   $deleted How to handle deleted node
245
+     * @param integer   $deleted How to handle deleted node
246 246
      */
247 247
     protected function _getNodes(
248 248
         $id = null,
Please login to merge, or discard this patch.
src/app/Balloon.App.Api/v1/File.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
      *
116 116
      * @param string $id
117 117
      * @param string $p
118
-     * @param string $version
118
+     * @param integer $version
119 119
      */
120 120
     public function postRestore(int $version, ?string $id = null, ?string $p = null): Response
121 121
     {
Please login to merge, or discard this patch.