Passed
Push — main ( 25b418...7229b6 )
by Miaad
01:55
created
tools/generator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return string
30 30
      */
31
-    public static function randomString (int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
31
+    public static function randomString(int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
32 32
         $rand_string = '';
33 33
         $char_len = strlen($characters) - 1;
34
-        for ($i = 0; $i < $length; $i ++) {
34
+        for ($i = 0; $i < $length; $i++) {
35 35
             $rand_string .= $characters[rand(0, $char_len)];
36 36
         }
37 37
         return $rand_string;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @return inlineKeyboardMarkup|replyKeyboardMarkup replyKeyboardMarkup for keyboard and inlineKeyboardMarkup for inline
61 61
      * @throws bptException
62 62
      */
63
-    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup|replyKeyboardMarkup {
63
+    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup | replyKeyboardMarkup {
64 64
         if (!empty($keyboard)) {
65 65
             $keyboard_object = new replyKeyboardMarkup();
66 66
             $keyboard_object->setResize_keyboard($keyboard['resize'] ?? true);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             return $keyboard_object;
120 120
         }
121 121
         else {
122
-            logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR);
122
+            logger::write("tools::eKey function used\nkeyboard or inline parameter must be set", loggerTypes::ERROR);
123 123
             throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE');
124 124
         }
125 125
     }
Please login to merge, or discard this patch.
lock.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
         return touch("$name.lock");
12 12
     }
13 13
 
14
-    public static function save(string $name, string $data): bool|int {
15
-        return file_put_contents("$name.lock", $data) && chmod("$name.lock",0640);
14
+    public static function save(string $name, string $data): bool | int {
15
+        return file_put_contents("$name.lock", $data) && chmod("$name.lock", 0640);
16 16
     }
17 17
 
18
-    public static function read(string $name): bool|string {
18
+    public static function read(string $name): bool | string {
19 19
         return file_get_contents("$name.lock");
20 20
     }
21 21
 
22
-    public static function mtime(string $name): bool|int {
22
+    public static function mtime(string $name): bool | int {
23 23
         return filemtime("$name.lock");
24 24
     }
25 25
 
Please login to merge, or discard this patch.
receiver/webhook.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use CURLFile;
14 14
 
15 15
 class webhook extends receiver {
16
-    public static function init () {
16
+    public static function init() {
17 17
         if (settings::$multi) {
18 18
             multi::init();
19 19
         }
@@ -42,26 +42,26 @@  discard block
 block discarded – undo
42 42
         }
43 43
     }
44 44
 
45
-    protected static function setWebhook(string $url,string $secret = '') {
45
+    protected static function setWebhook(string $url, string $secret = '') {
46 46
         $res = telegram::setWebhook($url, settings::$certificate, max_connections:settings::$max_connection, allowed_updates : settings::$allowed_updates, secret_token: $secret);
47 47
         if (telegram::$status) {
48
-            logger::write('Webhook was set successfully',loggerTypes::INFO);
48
+            logger::write('Webhook was set successfully', loggerTypes::INFO);
49 49
         }
50 50
         else {
51
-            logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
52
-            BPT::exit(print_r($res,true));
51
+            logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR);
52
+            BPT::exit(print_r($res, true));
53 53
         }
54 54
     }
55 55
 
56 56
     protected static function checkURL() {
57 57
         if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) {
58
-            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR);
58
+            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR);
59 59
             throw new bptException('WEBHOOK_NEED_URL');
60 60
         }
61 61
     }
62 62
 
63 63
     private static function setURL(): string {
64
-        return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
64
+        return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
65 65
     }
66 66
 
67 67
     protected static function setCertificate() {
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
         self::setCertificate();
84 84
         $url = self::setURL();
85 85
         $secret = tools::randomString(64);
86
-        self::setWebhook($url,$secret);
87
-        lock::save('BPT-HOOK',$secret);
86
+        self::setWebhook($url, $secret);
87
+        lock::save('BPT-HOOK', $secret);
88 88
         BPT::exit('Done');
89 89
     }
90 90
 
91 91
     private static function checkSecret() {
92 92
         $secret = lock::read('BPT-HOOK');
93 93
         if (!isset($_SERVER['HTTP_X_TELEGRAM_BOT_API_SECRET_TOKEN']) || $_SERVER['HTTP_X_TELEGRAM_BOT_API_SECRET_TOKEN'] != $secret) {
94
-            logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING);
94
+            logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING);
95 95
             self::processSetWebhook();
96 96
         }
97 97
     }
Please login to merge, or discard this patch.