Completed
Push — master ( 747a18...d4fe43 )
by Raffael
02:32
created
src/lib/Balloon/Plugin.php 1 patch
Spacing   +3 added lines, -3 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
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param   object|array $config
54 54
      * @return  bool
55 55
      */
56
-    public function registerPlugin($name, $config=null): bool
56
+    public function registerPlugin($name, $config = null): bool
57 57
     {
58 58
         if ($name instanceof Config) {
59 59
             foreach ($name as $id => $config) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param   array $context
113 113
      * @return  bool
114 114
      */
115
-    public function run(string $method, array $context=[]): bool
115
+    public function run(string $method, array $context = []): bool
116 116
     {
117 117
         $this->logger->debug('execute plugins hooks for ['.$method.']', [
118 118
             'category' => get_class($this),
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Router/Route.php 1 patch
Spacing   +7 added lines, -7 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
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param   array $params
74 74
      * @return  void
75 75
      */
76
-    public function __construct(string $path, $class, ?string $method=null, array $params=[])
76
+    public function __construct(string $path, $class, ? string $method = null, array $params = [])
77 77
     {
78 78
         $this->setPath($path);
79 79
         $this->setClass($class);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function match(): bool
91 91
     {
92
-        $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function ($match) {
92
+        $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function($match) {
93 93
             if (count($match) === 4) {
94 94
                 return '(?<'.$match[2].'>'.$match[3].'+)';
95 95
             } else {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param  array $constructor
119 119
      * @return array
120 120
      */
121
-    public function getCallable($constructor=[]): array
121
+    public function getCallable($constructor = []): array
122 122
     {
123 123
         if (is_object($this->class)) {
124 124
             $instance = $this->class;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @param   string $name
141 141
      * @return  string
142 142
      */
143
-    protected function _buildMethodName(?string $name): string
143
+    protected function _buildMethodName(? string $name) : string
144 144
     {
145 145
         $result = $this->router->getVerb();
146 146
         
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @param   string $method
266 266
      * @return  Route
267 267
      */
268
-    public function setMethod(?string $method): Route
268
+    public function setMethod(? string $method) : Route
269 269
     {
270 270
         $this->method = $method;
271 271
         return $this;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      * @param  bool $next
314 314
      * @return Route
315 315
      */
316
-    public function continuePropagation($next=true): Route
316
+    public function continuePropagation($next = true): Route
317 317
     {
318 318
         $this->continue_propagation = (bool)$next;
319 319
         return $this;
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Router.php 1 patch
Spacing   +3 added lines, -3 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
                     }
Please login to merge, or discard this patch.
src/lib/Balloon/Http/Exception.php 1 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/lib/Balloon/Http/Response.php 1 patch
Spacing   +3 added lines, -3 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
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param  bool $body_only
159 159
      * @return Response
160 160
      */
161
-    public function setBody($body, bool $body_only=false): Response
161
+    public function setBody($body, bool $body_only = false): Response
162 162
     {
163 163
         $this->body = $body;
164 164
         $this->body_only = $body_only;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $this->sendHeaders();
188 188
         $status = Http::STATUS_CODES[$this->code];
189
-        header('HTTP/1.0 ' . $this->code . ' ' . $status, true, $this->code);
189
+        header('HTTP/1.0 '.$this->code.' '.$status, true, $this->code);
190 190
 
191 191
         if ($this->body === null && $this->code == 204) {
192 192
             $this->terminate();
Please login to merge, or discard this patch.
src/lib/Balloon/Filesystem.php 1 patch
Spacing   +16 added lines, -16 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
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
      * @param   int $deleted
296 296
      * @return  INode
297 297
      */
298
-    public function findNodeWithId($id, ?string $class=null, int $deleted=INode::DELETED_INCLUDE): INode
298
+    public function findNodeWithId($id, ? string $class = null, int $deleted = INode::DELETED_INCLUDE) : INode
299 299
     {
300 300
         if (!is_string($id) && !($id instanceof ObjectID)) {
301 301
             throw new Exception\InvalidArgument($id.' node id has to be a string or instance of \MongoDB\BSON\ObjectID');
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
      * @param   string $class Fore check node type
354 354
      * @return  INode
355 355
      */
356
-    public function findNodeWithPath(string $path='', ?string $class=null): INode
356
+    public function findNodeWithPath(string $path = '', ? string $class = null) : INode
357 357
     {
358 358
         if (empty($path) || $path[0] != '/') {
359 359
             $path = '/'.$path;
360 360
         }
361 361
         
362
-        $last = strlen($path)-1;
362
+        $last = strlen($path) - 1;
363 363
         if ($path[$last] == '/') {
364 364
             $path = substr($path, 0, -1);
365 365
         }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      * @param   string $class Fore check node type
391 391
      * @return  INode
392 392
      */
393
-    public function findNodeWithShareToken(string $token, ?string $class=null): INode
393
+    public function findNodeWithShareToken(string $token, ? string $class = null) : INode
394 394
     {
395 395
         $node = $this->db->storage->findOne([
396 396
             'sharelink.token' => $token,
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      * @param   bool $deleted
435 435
      * @return  Generator
436 436
      */
437
-    public function findNodes(array $id=[], ?string $class=null, int $deleted=INode::DELETED_INCLUDE): Generator
437
+    public function findNodes(array $id = [], ? string $class = null, int $deleted = INode::DELETED_INCLUDE) : Generator
438 438
     {
439 439
         $id = (array)$id;
440 440
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      * @param   int $deleted
489 489
      * @return  array
490 490
      */
491
-    public function search(array $query, int $deleted=INode::DELETED_INCLUDE): array
491
+    public function search(array $query, int $deleted = INode::DELETED_INCLUDE): array
492 492
     {
493 493
         if ($this->user instanceof User) {
494 494
             $this->user->findNewShares();
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
                    ->setHosts((array)$this->config->search->hosts->server)
583 583
                    ->build();
584 584
 
585
-        $bool =  $query['body']['query'];
585
+        $bool = $query['body']['query'];
586 586
 
587 587
         $filter1 = [];
588 588
         $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId();
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
      * @param   bool $deleted How to handle deleted node
651 651
      * @return  INode
652 652
      */
653
-    public function getNode($id=null, $path=null, $class=null, $multiple=false, $allow_root=false, $deleted=null)
653
+    public function getNode($id = null, $path = null, $class = null, $multiple = false, $allow_root = false, $deleted = null)
654 654
     {
655 655
         if (empty($id) && empty($path)) {
656 656
             if ($allow_root === true) {
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
      * @return  array
767 767
      */
768 768
     public function findNodeAttributesWithCustomFilter(
769
-        ?array $filter = null,
769
+        ? array $filter = null,
770 770
         array $attributes = ['_id'],
771
-        ?int $limit = null,
772
-        ?int &$cursor = null,
773
-        ?bool &$has_more = null,
774
-        ?INode $parent = null)
771
+        ? int $limit = null,
772
+        ? int&$cursor = null,
773
+        ? bool&$has_more = null,
774
+        ? INode $parent = null)
775 775
     {
776 776
         $default = [
777 777
             '_id'       => 1,
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
 
784 784
         $search_attributes = array_merge($default, array_fill_keys($attributes, 1));
785 785
         $list   = [];
786
-        $result =$this->db->storage->find($filter, [
786
+        $result = $this->db->storage->find($filter, [
787 787
             'skip'      => $cursor,
788 788
             'limit'     => $limit,
789 789
             'projection'=> $search_attributes
790 790
         ]);
791 791
         
792
-        $left =$this->db->storage->count($filter, [
792
+        $left = $this->db->storage->count($filter, [
793 793
             'skip' => $cursor,
794 794
         ]);
795 795
 
Please login to merge, or discard this patch.
src/lib/Balloon/Auth.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
@@ -250,25 +250,25 @@  discard block
 block discarded – undo
250 250
 
251 251
                 switch ($value['type']) {
252 252
                     case 'array':
253
-                         $arr =  (array)$data[$value['attr']];
253
+                         $arr = (array)$data[$value['attr']];
254 254
                           unset($arr['count']);
255 255
                           $attrs[$attr] = $arr;
256 256
                     break;
257 257
                         
258 258
                     case 'string':
259
-                         $attrs[$attr]  = (string)$store;
259
+                         $attrs[$attr] = (string)$store;
260 260
                     break;
261 261
                                             
262 262
                     case 'int':
263
-                         $attrs[$attr]  = (int)$store;
263
+                         $attrs[$attr] = (int)$store;
264 264
                     break;
265 265
                                             
266 266
                     case 'bool':
267
-                         $attrs[$attr]  = (bool)$store;
267
+                         $attrs[$attr] = (bool)$store;
268 268
                     break;
269 269
                     
270 270
                     case 'binary':
271
-                         $attrs[$attr]  = new Binary($store, Binary::TYPE_GENERIC);
271
+                         $attrs[$attr] = new Binary($store, Binary::TYPE_GENERIC);
272 272
                     break;
273 273
                     
274 274
                     default:
Please login to merge, or discard this patch.
src/lib/Balloon/Helper.php 1 patch
Spacing   +3 added lines, -3 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
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param  UTCDateTime $date
50 50
      * @return StdClass
51 51
      */
52
-    public static function DateTimeToUnix(?UTCDateTime $date): ?Stdclass
52
+    public static function DateTimeToUnix(? UTCDateTime $date) : ? Stdclass
53 53
     {
54 54
         if ($date === null) {
55 55
             return null;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public static function isValidTimeStamp(string $timestamp): bool
149 149
     {
150
-        return ((string) (int) $timestamp === $timestamp)
150
+        return ((string)(int)$timestamp === $timestamp)
151 151
             && ($timestamp <= PHP_INT_MAX)
152 152
             && ($timestamp >= ~PHP_INT_MAX);
153 153
     }
Please login to merge, or discard this patch.
src/lib/Balloon/Logger.php 1 patch
Spacing   +10 added lines, -10 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
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param   Iterable $config
58 58
      * @return  void
59 59
      */
60
-    public function __construct(?Iterable $config=null)
60
+    public function __construct(? Iterable $config = null)
61 61
     {
62 62
         $this->setOptions($config);
63 63
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param  Iterable $config
70 70
      * @return Logger
71 71
      */
72
-    public function setOptions(?Iterable $config=null)
72
+    public function setOptions(? Iterable $config = null)
73 73
     {
74 74
         if ($config === null) {
75 75
             return $this;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * @param  Iterable $config
94 94
      * @return AdapterInterface
95 95
      */
96
-    public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface
96
+    public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface
97 97
     {
98 98
         if (isset($this->adapter[$name])) {
99 99
             throw new Exception\InvalidArgument('log adapter '.$name.' is already registered');
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @param  array $adapters
131 131
      * @return array
132 132
      */
133
-    public function getAdapters(array $adapters=[]): array
133
+    public function getAdapters(array $adapters = []): array
134 134
     {
135 135
         if (empty($adapter)) {
136 136
             return $this->adapter;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param   array $context
158 158
      * @return  bool
159 159
      */
160
-    public function log($level, $message, array $context=[]): bool
160
+    public function log($level, $message, array $context = []): bool
161 161
     {
162 162
         if (!array_key_exists($level, self::PRIORITIES)) {
163 163
             throw new Exception\InvalidArgument('log level '.$level.' is unkown');
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
      * @param   array $context
201 201
      * @return  void
202 202
      */
203
-    protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string
203
+    protected function _format(string $message, string $format, string $date_format, string $level, array $context = []): string
204 204
     {
205
-        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($message, $level, $date_format, $context) {
205
+        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($message, $level, $date_format, $context) {
206 206
             $key = '';
207 207
             $context = array_merge($this->context, $context);
208 208
                     
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
                     $replace = [];
226 226
                     foreach ($context as $key => $val) {
227 227
                         if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
228
-                            $replace['{' . $key . '}'] = $val;
228
+                            $replace['{'.$key.'}'] = $val;
229 229
                         } else {
230
-                            $replace['{' . $key . '}'] = json_encode($val);
230
+                            $replace['{'.$key.'}'] = json_encode($val);
231 231
                         }
232 232
                     }
233 233
 
Please login to merge, or discard this patch.