Passed
Push — main ( f82312...487838 )
by Miaad
10:48 queued 13s
created
src/receiver/webhook.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @internal Only for BPT self usage , Don't use it in your source!
20 20
      */
21
-    public static function init () {
21
+    public static function init() {
22 22
         if (settings::$multi) {
23 23
             multi::init();
24 24
         }
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
         lock::deleteIfExist(['BPT-MULTI-EXEC', 'BPT-MULTI-CURL', 'getUpdate', 'getUpdateHook']);
39 39
     }
40 40
 
41
-    protected static function setWebhook(string $url,string $secret = '') {
41
+    protected static function setWebhook(string $url, string $secret = '') {
42 42
         $res = BPT::setWebhook($url, settings::$certificate, max_connections: settings::$max_connection, allowed_updates: settings::$allowed_updates, drop_pending_updates: settings::$skip_old_updates, secret_token: $secret);
43 43
         if (!BPT::$status) {
44
-            logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
45
-            BPT::exit(print_r($res,true));
44
+            logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR);
45
+            BPT::exit(print_r($res, true));
46 46
         }
47
-        logger::write('Webhook was set successfully',loggerTypes::INFO);
47
+        logger::write('Webhook was set successfully', loggerTypes::INFO);
48 48
     }
49 49
 
50 50
     protected static function checkURL() {
51 51
         if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) {
52
-            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR);
52
+            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR);
53 53
             throw new bptException('WEBHOOK_NEED_URL');
54 54
         }
55 55
     }
56 56
 
57 57
     protected static function setURL(): string {
58 58
         if (isset($_GET['token'])) {
59
-            logger::write('You can not specify token in url',loggerTypes::ERROR);
59
+            logger::write('You can not specify token in url', loggerTypes::ERROR);
60 60
             BPT::exit('You can not specify token in url');
61 61
         }
62
-        return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
62
+        return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
63 63
     }
64 64
 
65 65
     protected static function setCertificate() {
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
         self::checkURL();
75 75
         self::setCertificate();
76 76
         $url = self::setURL();
77
-        $secret = !empty(settings::$secret) ? settings::$secret : str_replace(':','---',settings::$token);
78
-        self::setWebhook($url,$secret);
77
+        $secret = !empty(settings::$secret) ? settings::$secret : str_replace(':', '---', settings::$token);
78
+        self::setWebhook($url, $secret);
79 79
         lock::save('BPT-HOOK', md5($secret));
80 80
         BPT::exit('Done');
81 81
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 BPT::exit();
89 89
             }
90 90
             if (settings::$telegram_verify) {
91
-                logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING);
91
+                logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING);
92 92
                 self::processSetWebhook();
93 93
             }
94 94
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      *
111 111
      * @return bool
112 112
      */
113
-    public static function fastClose (int $timeout = 86400): bool {
113
+    public static function fastClose(int $timeout = 86400): bool {
114 114
         if (settings::$multi || !lock::exist('BPT-HOOK') || settings::$receiver !== \BPT\constants\receiver::WEBHOOK) {
115 115
             return false;
116 116
         }
Please login to merge, or discard this patch.
src/receiver/callback.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
 use BPT\tools\tools;
10 10
 
11 11
 class callback {
12
-    public static function encodeData (array $data): string {
12
+    public static function encodeData(array $data): string {
13 13
         return tools::codec(codecAction::ENCRYPT, json_encode($data), md5(settings::$token), 'SguQgUvvKRLvmCyq')['hash'];
14 14
     }
15 15
 
16
-    public static function decodeData (string $data): array {
16
+    public static function decodeData(string $data): array {
17 17
         return json_decode(tools::codec(codecAction::DECRYPT, $data, md5(settings::$token), 'SguQgUvvKRLvmCyq'), true);
18 18
     }
19 19
 
20 20
     /**
21 21
      * @internal Only for BPT self usage , Don't use it in your source!
22 22
      */
23
-    public static function process () {
23
+    public static function process() {
24 24
         if (!settings::$handler || settings::$receiver != \BPT\constants\receiver::WEBHOOK || settings::$multi || !(isset($_GET['data']) || isset($_POST['data']))) {
25 25
             return false;
26 26
         }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     /**
46 46
      * @internal Only for BPT self usage , Don't use it in your source!
47 47
      */
48
-    public static function callHandler (string $handler_name, $input) {
48
+    public static function callHandler(string $handler_name, $input) {
49 49
         if (method_exists(BPT::$handler, $handler_name)) {
50 50
             BPT::$handler->$handler_name($input);
51 51
         }
Please login to merge, or discard this patch.
src/BPT.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
  * @method gameHighScore[]|responseError getGameHighScores (int|array|null $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.
300 300
  * @method gameHighScore[]|responseError getGameHigh (int|array|null $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.
301 301
  */
302
-class BPT extends telegram{
303
-    public static stdClass|update $update;
302
+class BPT extends telegram {
303
+    public static stdClass | update $update;
304 304
 
305 305
     public static BPT $handler;
306 306
 
307 307
 
308
-    public function __construct (array|easySettings $settings) {
308
+    public function __construct(array | easySettings $settings) {
309 309
         static::$handler = &$this;
310 310
         settings::init($settings);
311 311
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     }
316 316
 
317 317
     #[NoReturn]
318
-    public static function exit (string|null $message = null): void {
318
+    public static function exit (string | null $message = null): void {
319 319
         die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>");
320 320
     }
321 321
 }
Please login to merge, or discard this patch.