Completed
Push — master ( 9c9bdc...7f109c )
by
unknown
02:56
created
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.
src/lib/Balloon/Filesystem/Delta.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
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @param   string $cursor
86 86
      * @return  array
87 87
      */
88
-    protected function decodeCursor(?string $cursor): ?array
88
+    protected function decodeCursor(?string $cursor) : ? array
89 89
     {
90 90
         if ($cursor === null) {
91 91
             return null;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param   INode $node
116 116
      * @return  array
117 117
      */
118
-    public function buildFeedFromCurrentState(?array $cursor=null, int $limit=100, array $attributes=[], ?INode $node=null): array
118
+    public function buildFeedFromCurrentState(? array $cursor = null, int $limit = 100, array $attributes = [], ?INode $node = null) : array
119 119
     {
120 120
         $current_cursor = 0;
121 121
         $filter = ['$and' => [
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $ts       = $last['timestamp'];
154 154
             }
155 155
 
156
-            $reset  = true;
156
+            $reset = true;
157 157
             if ($has_more === false) {
158 158
                 $cursor = base64_encode('delta|0|0|'.$delta_id.'|'.$ts);
159 159
             } else {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param  INode $node
202 202
      * @return BSONDocument
203 203
      */
204
-    public function getLastRecord(?INode $node=null): ?BSONDocument
204
+    public function getLastRecord(?INode $node = null) : ?BSONDocument
205 205
     {
206 206
         $filter = $this->getDeltaFilter();
207 207
         
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param  INode $node
228 228
      * @return string
229 229
      */
230
-    public function getLastCursor(?INode $node=null): string
230
+    public function getLastCursor(?INode $node = null) : string
231 231
     {
232 232
         $filter = $this->getDeltaFilter();
233 233
         
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
      * @param   INode $node
260 260
      * @return  array
261 261
      */
262
-    public function getDeltaFeed(?string $cursor=null, int $limit=250, array $attributes=[], ?INode $node=null): array
262
+    public function getDeltaFeed(?string $cursor = null, int $limit = 250, array $attributes = [], ?INode $node = null) : array
263 263
     {
264 264
         $this->user->findNewShares();
265 265
 
266
-        $attributes = array_merge(['id', 'directory', 'deleted',  'path', 'changed', 'created', 'owner'],
266
+        $attributes = array_merge(['id', 'directory', 'deleted', 'path', 'changed', 'created', 'owner'],
267 267
             $attributes);
268 268
 
269 269
         $cursor = $this->decodeCursor($cursor);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      * @param   INode $node
422 422
      * @return  array
423 423
      */
424
-    public function getEventLog(int $limit=100, int $skip=0, ?INode $node=null): array
424
+    public function getEventLog(int $limit = 100, int $skip = 0, ?INode $node = null) : array
425 425
     {
426 426
         $filter = $this->getDeltaFilter();
427 427
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
         
449 449
         $events = [];
450 450
         foreach ($result as $log) {
451
-            $id    = (string)$log['_id'];
451
+            $id = (string)$log['_id'];
452 452
             $events[$id] = [
453 453
                 'event'     => $id,
454 454
                 'timestamp' => Helper::DateTimeToUnix($log['timestamp']),
Please login to merge, or discard this patch.
src/lib/Balloon/Ldap.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
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @var bool
87 87
      */
88
-    protected $tls=false;
88
+    protected $tls = false;
89 89
 
90 90
 
91 91
     /**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @param  Iterable $config
152 152
      * @return Ldap
153 153
      */
154
-    public function setOptions(?Iterable $config): Ldap
154
+    public function setOptions(?Iterable $config) : Ldap
155 155
     {
156 156
         if ($config === null) {
157 157
             return $this;
Please login to merge, or discard this patch.
src/lib/Balloon/Auth/Adapter/Preauth.php 1 patch
Spacing   +5 added lines, -5 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
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param   Iterable $config
41 41
      * @return  LdapServer
42 42
      */
43
-    public function setOptions(?Iterable $config): LdapServer
43
+    public function setOptions(?Iterable $config) : LdapServer
44 44
     {
45 45
         if ($config === null) {
46 46
             return $this;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function preauth(string $value): bool
110 110
     {
111
-        $parts   = explode('|', $value);
111
+        $parts = explode('|', $value);
112 112
 
113 113
         if (count($parts) !== 2) {
114 114
             $this->logger->warning('invalid header x-preauth value, parts != 2', [
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             'category' => get_class($this)
196 196
         ]);
197 197
 
198
-        $this->ldap_dn   = $dn;
198
+        $this->ldap_dn = $dn;
199 199
 
200 200
         return true;
201 201
     }
@@ -220,6 +220,6 @@  discard block
 block discarded – undo
220 220
         $ip_decimal = ip2long($ip);
221 221
         $wildcard_decimal = pow(2, (32 - $netmask)) - 1;
222 222
         $netmask_decimal = ~ $wildcard_decimal;
223
-        return (($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal));
223
+        return (($ip_decimal&$netmask_decimal) == ($range_decimal&$netmask_decimal));
224 224
     }
225 225
 }
Please login to merge, or discard this patch.
src/lib/Balloon/Auth/Adapter/AdapterInterface.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/Auth/Adapter/None.php 1 patch
Spacing   +2 added lines, -2 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
      *
42 42
      * @return int
43 43
      */
44
-    public function getAttributeSyncCache(): int
44
+    public function getAttributeSyncCache() : int
45 45
     {
46 46
         return -1;
47 47
     }
Please login to merge, or discard this patch.
src/lib/Balloon/Auth/Adapter/Basic/Db.php 1 patch
Spacing   +4 added lines, -4 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
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function __construct(?Iterable $config, Logger $logger)
61 61
     {
62
-        $this->logger  = $logger;
62
+        $this->logger = $logger;
63 63
         $this->setOptions($config);
64 64
     }
65 65
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param   Iterable
71 71
      * @return  Ldap
72 72
      */
73
-    public function setOptions(?Iterable $config): Db
73
+    public function setOptions(?Iterable $config) : Db
74 74
     {
75 75
         if ($config === null) {
76 76
             return $this;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             return false;
198 198
         }
199 199
 
200
-        $this->identity  = $username;
200
+        $this->identity = $username;
201 201
         return true;
202 202
     }
203 203
 
Please login to merge, or discard this patch.
src/lib/Balloon/Auth/Adapter/Basic/Ldap.php 1 patch
Spacing   +2 added lines, -2 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
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param   Iterable
110 110
      * @return  Ldap
111 111
      */
112
-    public function setOptions(?Iterable $config): LdapServer
112
+    public function setOptions(?Iterable $config) : LdapServer
113 113
     {
114 114
         if ($config === null) {
115 115
             return $this;
Please login to merge, or discard this patch.
src/lib/Balloon/Auth/Adapter/Oauth2.php 1 patch
Spacing   +4 added lines, -4 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
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * @param   Iterable
111 111
      * @return  Oauth2
112 112
      */
113
-    public function setOptions(?Iterable $config): Oauth2
113
+    public function setOptions(?Iterable $config) : Oauth2
114 114
     {
115 115
         if ($config === null) {
116 116
             return $this;
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
         $jre = json_decode($re);
267 267
         
268 268
         if ($jre->status == "success") {
269
-            return (array) $jre->data;
269
+            return (array)$jre->data;
270 270
         } elseif ($jre->status == "fail") {
271
-            throw new Exception('Error while validating the acces token. Auth server responded: ' . $jre->message);
271
+            throw new Exception('Error while validating the acces token. Auth server responded: '.$jre->message);
272 272
         } else {
273 273
             throw new Exception('could not decode response: '.$re);
274 274
         }
Please login to merge, or discard this patch.