@@ -92,7 +92,7 @@ |
||
92 | 92 | * @param string $id |
93 | 93 | * @param string $p |
94 | 94 | * @param int $deleted |
95 | - * @param array $filter |
|
95 | + * @param Parameter\JSON $filter |
|
96 | 96 | * @param array $attributes |
97 | 97 | * @return Response |
98 | 98 | */ |
@@ -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 |
@@ -41,7 +41,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * Initialize |
19 | 19 | * |
20 | - * @param ReflectionParameter $param |
|
20 | + * @param \ReflectionParameter $param |
|
21 | 21 | * @param string $value |
22 | 22 | * @return void |
23 | 23 | */ |
@@ -24,17 +24,17 @@ |
||
24 | 24 | public function __construct(\ReflectionParameter $param, $value) |
25 | 25 | { |
26 | 26 | if(is_array($value)) { |
27 | - $data = $value; |
|
27 | + $data = $value; |
|
28 | 28 | } else { |
29 | - if(!is_string($value)) { |
|
29 | + if(!is_string($value)) { |
|
30 | 30 | throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. ' . gettype($value).' given.'); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - $data = json_decode($value); |
|
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()); |
|
37 | - } |
|
35 | + if($data === null) { |
|
36 | + throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. ' . json_last_error_msg()); |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return call_user_func_array(array('parent', __FUNCTION__), [$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 |
@@ -23,17 +23,17 @@ discard block |
||
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 |
@@ -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 | } |
@@ -341,13 +341,13 @@ discard block |
||
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 |
||
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; |