Passed
Push — main ( e1a2dc...e011f6 )
by Miaad
02:06
created
tools.php 1 patch
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
             curl_exec($ch);
258 258
             $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
259 259
             curl_close($ch);
260
-        }
261
-        else {
260
+        } else {
262 261
             $size = file_exists($path) ? filesize($path) : false;
263 262
         }
264 263
 
265 264
         if (isset($size) && is_numeric($size)) {
266 265
             return $format ? tools::byteFormat($size) : $size;
267
-        }
268
-        else return false;
266
+        } else {
267
+            return false;
268
+        }
269 269
     }
270 270
 
271 271
     //fix methods after here comments
@@ -293,15 +293,16 @@  discard block
 block discarded – undo
293 293
                         $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());
294 294
                     }
295 295
                     rmdir($path);
296
-                }
297
-                else {
296
+                } else {
298 297
                     logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR);
299 298
                     return false;
300 299
                 }
301
-            }
302
-            else rmdir($path);
303
-        }
304
-        else unlink($path);
300
+            } else {
301
+                rmdir($path);
302
+            }
303
+        } else {
304
+            unlink($path);
305
+        }
305 306
 
306 307
         return true;
307 308
     }
@@ -328,8 +329,9 @@  discard block
 block discarded – undo
328 329
         foreach ($string as $k => &$v) {
329 330
             if ($diff->$v) {
330 331
                 $v = $diff->$v;
331
-            }
332
-            else unset($string[$k]);
332
+            } else {
333
+                unset($string[$k]);
334
+            }
333 335
         }
334 336
         $string['status'] = $status;
335 337
         return count($string) > 1 ? $string : ['status' => 'now'];
Please login to merge, or discard this patch.
api/request/curl.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
             $curl_handler = curl_init(settings::$base_url."$token/");
37 37
             curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
38 38
             curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
39
-        }
40
-        else{
39
+        } else{
41 40
             $token = settings::$token;
42 41
             if (!isset(self::$curl_handler)){
43 42
                 self::$curl_handler = curl_init(settings::$base_url."$token/");
@@ -59,11 +58,9 @@  discard block
 block discarded – undo
59 58
         if (isset($data['forgot'])) {
60 59
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time);
61 60
             unset($data['forgot']);
62
-        }
63
-        elseif ($method === 'getUpdates'){
61
+        } elseif ($method === 'getUpdates'){
64 62
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000);
65
-        }
66
-        else{
63
+        } else{
67 64
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300);
68 65
         }
69 66
     }
Please login to merge, or discard this patch.
api/telegram.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -219,8 +219,7 @@  discard block
 block discarded – undo
219 219
     public function __call (string $name, array $arguments) {
220 220
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
221 221
             return request::$name(...$arguments[0]);
222
-        }
223
-        else {
222
+        } else {
224 223
             return request::$name(...$arguments);
225 224
         }
226 225
     }
@@ -228,8 +227,7 @@  discard block
 block discarded – undo
228 227
     public static function __callStatic (string $name, array $arguments) {
229 228
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
230 229
             return request::$name(...$arguments[0]);
231
-        }
232
-        else {
230
+        } else {
233 231
             return request::$name(...$arguments);
234 232
         }
235 233
     }
Please login to merge, or discard this patch.
api/request.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -418,12 +418,10 @@  discard block
 block discarded – undo
418 418
             self::setDefaults($action,$arguments);
419 419
             if (isset($arguments['answer'])) {
420 420
                 return answer::init($action,$arguments);
421
-            }
422
-            else {
421
+            } else {
423 422
                 return curl::init($action,$arguments);
424 423
             }
425
-        }
426
-        else {
424
+        } else {
427 425
             logger::write("$name method is not supported",loggerTypes::ERROR);
428 426
         }
429 427
     }
@@ -448,8 +446,7 @@  discard block
 block discarded – undo
448 446
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
449 447
                 }
450 448
             }
451
-        }
452
-        elseif ($file_params = self::methodFile($name)) {
449
+        } elseif ($file_params = self::methodFile($name)) {
453 450
             foreach ($file_params as $param) {
454 451
                 if (isset($arguments[$param]) && file_exists($arguments[$param])) {
455 452
                     $arguments[$param] = new CURLFile($arguments[$param]);
@@ -469,8 +466,7 @@  discard block
 block discarded – undo
469 466
                 if (!isset($arguments[$default])){
470 467
                     $arguments[$default] = self::catchFields($default);
471 468
                 }
472
-            }
473
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
469
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
474 470
                 foreach ($default as $def) {
475 471
                     if (!isset($arguments[$def])){
476 472
                         $arguments[$def] = self::catchFields($def);
@@ -510,9 +506,13 @@  discard block
 block discarded – undo
510 506
                     default => false
511 507
                 };
512 508
             case 'file_id' :
513
-                if (isset(BPT::$update->message)) $type = 'message';
514
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
515
-                else return false;
509
+                if (isset(BPT::$update->message)) {
510
+                    $type = 'message';
511
+                } elseif (isset(BPT::$update->edited_message)) {
512
+                    $type = 'edited_message';
513
+                } else {
514
+                    return false;
515
+                }
516 516
 
517 517
                 return match(true) {
518 518
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.
BPT.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@
 block discarded – undo
233 233
     public function __call (string $name, array $arguments) {
234 234
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
235 235
             return request::$name(...$arguments[0]);
236
-        }
237
-        else {
236
+        } else {
238 237
             return request::$name(...$arguments);
239 238
         }
240 239
     }
Please login to merge, or discard this patch.
settings.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,11 +65,9 @@  discard block
 block discarded – undo
65 65
         foreach ($settings as $setting => $value) {
66 66
             try{
67 67
                 self::$$setting = $value;
68
-            }
69
-            catch (TypeError){
68
+            } catch (TypeError){
70 69
                 logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING);
71
-            }
72
-            catch (Error){
70
+            } catch (Error){
73 71
                 logger::write("$setting setting is not one of library settings",loggerTypes::WARNING);
74 72
             }
75 73
         }
@@ -80,12 +78,10 @@  discard block
 block discarded – undo
80 78
                 self::secureFolder();
81 79
                 self::db();
82 80
                 self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates();
83
-            }
84
-            else {
81
+            } else {
85 82
                 logger::write('token format is not right, check it and try again',loggerTypes::ERROR);
86 83
             }
87
-        }
88
-        else {
84
+        } else {
89 85
             logger::write('You must specify token parameter in settings',loggerTypes::ERROR);
90 86
         }
91 87
     }
@@ -126,8 +122,7 @@  discard block
 block discarded – undo
126 122
     private static function getUpdates() {
127 123
         if (self::$handler) {
128 124
             getUpdates::init();
129
-        }
130
-        else {
125
+        } else {
131 126
             logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR);
132 127
         }
133 128
     }
Please login to merge, or discard this patch.