Completed
Pull Request — master (#52)
by
unknown
03:05
created
src/lib/Balloon/Rest/v1/Collection.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param   string $p
42 42
      * @return  Response
43 43
      */
44
-    public function headChildren(?string $id=null, ?string $p=null): Response
44
+    public function headChildren(? string $id = null, ? string $p = null) : Response
45 45
     {
46 46
         $result   = $this->fs->getNode($id, $p, null, false, true);
47 47
         $children = $result->getSize();
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
      * @return Response
98 98
      */
99 99
     public function getChildren(
100
-        ?string $id=null,
101
-        ?string $p=null,
102
-        int $deleted=0,
103
-        Parameter\JSON $filter=NULL,
104
-        array $attributes=[]): Response
100
+        ? string $id = null,
101
+        ? string $p = null,
102
+        int $deleted = 0,
103
+        Parameter\JSON $filter = NULL,
104
+        array $attributes = []) : Response
105 105
     {
106 106
         $children = [];
107 107
         $nodes = $this->fs->getNode($id, $p, null, false, true)->getChildNodes($deleted, (array)$filter);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param  string $p
153 153
      * @return Response
154 154
      */
155
-    public function getShare(?string $id=null, ?string $p=null): Response
155
+    public function getShare(? string $id = null, ? string $p = null) : Response
156 156
     {
157 157
         $result = $this->fs->getNode($id, $p)->getShare();
158 158
         return (new Response())->setCode(200)->setBody($result);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param  array $acl
201 201
      * @return Response
202 202
      */
203
-    public function postShare(array $acl, ?string $id=null, ?string $p=null): Response
203
+    public function postShare(array $acl, ? string $id = null, ? string $p = null) : Response
204 204
     {
205 205
         $node    = $this->fs->getNode($id, $p);
206 206
         $result  = $node->share($acl);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * @param  string $p
237 237
      * @return Response
238 238
      */
239
-    public function deleteShare(?string $id=null, ?string $p=null): Response
239
+    public function deleteShare(? string $id = null, ? string $p = null) : Response
240 240
     {
241 241
         $node = $this->fs->getNode($id, $p);
242 242
         $result = $node->unshare();
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
      * @return Response
292 292
      */
293 293
     public function post(
294
-        ?string $id=null,
295
-        ?string $p=null,
296
-        ?string $name=null,
297
-        array $attributes=[],
298
-        int $conflict=0): Response
294
+        ? string $id = null,
295
+        ? string $p = null,
296
+        ? string $name = null,
297
+        array $attributes = [],
298
+        int $conflict = 0) : Response
299 299
     {
300 300
         if ($p !== null && $name !== null) {
301 301
             throw new Exception\InvalidArgument('p and name can not be used at the same time');
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Router.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                     }
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
                     $param_value = $request_params[$param->name];
342 342
                 } elseif (isset($json_params[$param->name])) {
343 343
                     $param_value = $json_params[$param->name];
344
-                } else if($optional === true) {
344
+                } else if ($optional === true) {
345 345
                     $param_value = $param->getDefaultValue();
346 346
                 } else {
347 347
                     $param_value = null;
348 348
                 }
349 349
 
350
-                switch($type) {
350
+                switch ($type) {
351 351
                     case 'bool':
352 352
                         $return[$param->name] = Helper::boolParam($param_value);
353 353
                     break;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                         $return[$param->name] = (array)$param_value;
359 359
                     break;
360 360
                     default:
361
-                        if(class_exists($type) && $param_value!==null) {
361
+                        if (class_exists($type) && $param_value !== null) {
362 362
                             $return[$param->name] = new $type($param, $param_value);
363 363
                         } else {
364 364
                             $return[$param->name] = $param_value;
Please login to merge, or discard this patch.
src/lib/Balloon/Rest/v1/Parameter/JSON.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(\ReflectionParameter $param, $value)
25 25
     {
26
-        if(is_array($value)) {
26
+        if (is_array($value)) {
27 27
           $data = $value;
28 28
         } else {
29
-          if(!is_string($value)) {
30
-            throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. ' . gettype($value).' given.');
29
+          if (!is_string($value)) {
30
+            throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. '.gettype($value).' given.');
31 31
           }
32 32
 
33 33
           $data = json_decode($value);
34 34
 
35
-          if($data === null) {
36
-              throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. ' . json_last_error_msg());
35
+          if ($data === null) {
36
+              throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. '.json_last_error_msg());
37 37
           }
38 38
         }
39 39
 
Please login to merge, or discard this patch.