Passed
Push — main ( ca9ae3...e465fe )
by Miaad
10:35
created
src/types/stickerSet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     public string $sticker_type;
22 22
 
23 23
     /** True, if the sticker set contains animated stickers */
24
-    public null|bool $is_animated = null;
24
+    public null | bool $is_animated = null;
25 25
 
26 26
     /** True, if the sticker set contains video stickers */
27
-    public null|bool $is_video = null;
27
+    public null | bool $is_video = null;
28 28
 
29 29
     /** Deprecated use sticker_type instead, True, if the sticker set contains masks */
30
-    public null|bool $contains_masks = null;
30
+    public null | bool $contains_masks = null;
31 31
 
32 32
     /**
33 33
      * List of all set stickers
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
     public array $stickers;
37 37
 
38 38
     /** Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */
39
-    public null|photoSize $thumbnail = null;
39
+    public null | photoSize $thumbnail = null;
40 40
 
41 41
 
42
-    public function __construct(stdClass|null $object = null) {
42
+    public function __construct(stdClass | null $object = null) {
43 43
         if ($object != null) {
44 44
             parent::__construct($object, self::subs);
45 45
         }
Please login to merge, or discard this patch.
src/types/document.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
     public string $file_unique_id;
23 23
 
24 24
     /** Optional. Document thumbnail as defined by sender */
25
-    public null|photoSize $thumbnail = null;
25
+    public null | photoSize $thumbnail = null;
26 26
 
27 27
     /** Optional. Original filename as defined by sender */
28
-    public null|string $file_name = null;
28
+    public null | string $file_name = null;
29 29
 
30 30
     /** Optional. MIME type of the file as defined by sender */
31
-    public null|string $mime_type = null;
31
+    public null | string $mime_type = null;
32 32
 
33 33
     /**
34 34
      * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
35 35
      * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
36 36
      * integer or double-precision float type are safe for storing this value.
37 37
      */
38
-    public null|int $file_size = null;
38
+    public null | int $file_size = null;
39 39
 
40 40
 
41
-    public function __construct(stdClass|null $object = null) {
41
+    public function __construct(stdClass | null $object = null) {
42 42
         if ($object != null) {
43 43
             parent::__construct($object, self::subs);
44 44
         }
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @return bool|string string will be returned when destination doesn't set
61 61
      */
62
-    public function download(string|null $destination = null): bool|string {
63
-        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt',$this->file_id);
62
+    public function download(string | null $destination = null): bool | string {
63
+        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt', $this->file_id);
64 64
     }
65 65
 
66 66
     public function link(): string {
Please login to merge, or discard this patch.
src/types/botDescription.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public string $description;
19 19
 
20 20
 
21
-    public function __construct(stdClass|null $object = null) {
21
+    public function __construct(stdClass | null $object = null) {
22 22
         if ($object != null) {
23 23
             parent::__construct($object, self::subs);
24 24
         }
Please login to merge, or discard this patch.
src/types/sticker.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,34 +38,34 @@  discard block
 block discarded – undo
38 38
     public int $height;
39 39
 
40 40
     /** True, if the sticker is animated */
41
-    public null|bool $is_animated = null;
41
+    public null | bool $is_animated = null;
42 42
 
43 43
     /** True, if the sticker is a video sticker */
44
-    public null|bool $is_video = null;
44
+    public null | bool $is_video = null;
45 45
 
46 46
     /** Optional. Sticker thumbnail in the .WEBP or .JPG format */
47
-    public null|photoSize $thumbnail = null;
47
+    public null | photoSize $thumbnail = null;
48 48
 
49 49
     /** Optional. Emoji associated with the sticker */
50
-    public null|string $emoji = null;
50
+    public null | string $emoji = null;
51 51
 
52 52
     /** Optional. Name of the sticker set to which the sticker belongs */
53
-    public null|string $set_name = null;
53
+    public null | string $set_name = null;
54 54
 
55 55
     /** Optional. Premium animation for the sticker, if the sticker is premium */
56
-    public null|file $premium_animation = null;
56
+    public null | file $premium_animation = null;
57 57
 
58 58
     /** Optional. For mask stickers, the position where the mask should be placed */
59
-    public null|maskPosition $mask_position = null;
59
+    public null | maskPosition $mask_position = null;
60 60
 
61 61
     /** Optional. For custom emoji stickers, unique identifier of the custom emoji */
62
-    public null|string $custom_emoji_id = null;
62
+    public null | string $custom_emoji_id = null;
63 63
 
64 64
     /** Optional. File size in bytes */
65
-    public null|int $file_size = null;
65
+    public null | int $file_size = null;
66 66
 
67 67
 
68
-    public function __construct(stdClass|null $object = null) {
68
+    public function __construct(stdClass | null $object = null) {
69 69
         if ($object != null) {
70 70
             parent::__construct($object, self::subs);
71 71
         }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return bool|string string will be returned when destination doesn't set
88 88
      */
89
-    public function download(string|null $destination = null): bool|string {
90
-        return telegram::downloadFile($destination ?? 'unknown.png',$this->file_id);
89
+    public function download(string | null $destination = null): bool | string {
90
+        return telegram::downloadFile($destination ?? 'unknown.png', $this->file_id);
91 91
     }
92 92
 
93 93
     public function link(): string {
Please login to merge, or discard this patch.
src/telegram/request.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -812,30 +812,30 @@  discard block
 block discarded – undo
812 812
         'getGameHighScores'               => ['BPT\types\gameHighScore']
813 813
     ];
814 814
 
815
-    public static function __callStatic (string $name, array $arguments) {
815
+    public static function __callStatic(string $name, array $arguments) {
816 816
         if (!$action = self::methodAction($name)) {
817
-            logger::write("$name method is not supported",loggerTypes::ERROR);
817
+            logger::write("$name method is not supported", loggerTypes::ERROR);
818 818
             throw new bptException('METHOD_NOT_FOUND');
819 819
         }
820 820
         self::checkArguments($arguments);
821
-        self::keysName($action,$arguments);
822
-        self::readyFile($action,$arguments);
821
+        self::keysName($action, $arguments);
822
+        self::readyFile($action, $arguments);
823 823
         self::cleanArguments($arguments);
824
-        self::setDefaults($action,$arguments);
824
+        self::setDefaults($action, $arguments);
825 825
 
826 826
         if (isset($arguments['answer']) && $arguments['answer'] === true) {
827 827
             unset($arguments['answer']);
828 828
             if (!answer::isAnswered()) {
829
-                return answer::init($action,$arguments);
829
+                return answer::init($action, $arguments);
830 830
             }
831
-            logger::write('you can use answer mode only once for each webhook update, Others will be called like normal',loggerTypes::WARNING);
831
+            logger::write('you can use answer mode only once for each webhook update, Others will be called like normal', loggerTypes::WARNING);
832 832
         }
833
-        $result = curl::init($action,$arguments);
833
+        $result = curl::init($action, $arguments);
834 834
         if (!is_object($result)) {
835
-            logger::write("Telegram $action method failed : " . $result, loggerTypes::WARNING);
835
+            logger::write("Telegram $action method failed : ".$result, loggerTypes::WARNING);
836 836
             return false;
837 837
         }
838
-        return self::processResponse($action,$result);
838
+        return self::processResponse($action, $result);
839 839
     }
840 840
 
841 841
     private static function checkArguments(array &$arguments): void {
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
         }
845 845
     }
846 846
 
847
-    private static function keysName (string $name, array &$arguments): void {
847
+    private static function keysName(string $name, array &$arguments): void {
848 848
         foreach ($arguments as $key => $argument) {
849 849
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
850 850
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
         }
854 854
     }
855 855
 
856
-    private static function methodAction(string $name): string|false {
856
+    private static function methodAction(string $name): string | false {
857 857
         return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
858 858
     }
859 859
 
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
         }
887 887
     }
888 888
 
889
-    private static function methodFile(string $name): array|false {
889
+    private static function methodFile(string $name): array | false {
890 890
         return self::METHODS_WITH_FILE[$name] ?? false;
891 891
     }
892 892
 
893
-    private static function methodReturn(string $name,stdClass $response) {
893
+    private static function methodReturn(string $name, stdClass $response) {
894 894
         if (!isset(self::METHODS_RETURN[$name])) {
895 895
             return $response->result;
896 896
         }
@@ -909,13 +909,13 @@  discard block
 block discarded – undo
909 909
         $defaults = self::METHODS_EXTRA_DEFAULTS[$name];
910 910
         foreach ($defaults as $key => $default) {
911 911
             if (is_numeric($key)) {
912
-                if (!isset($arguments[$default])){
912
+                if (!isset($arguments[$default])) {
913 913
                     $arguments[$default] = self::catchFields($default);
914 914
                 }
915 915
             }
916 916
             elseif (isset(BPT::$update->$key) || $key === 'other') {
917 917
                 foreach ($default as $def) {
918
-                    if (!isset($arguments[$def])){
918
+                    if (!isset($arguments[$def])) {
919 919
                         $arguments[$def] = self::catchFields($def);
920 920
                     }
921 921
                 }
@@ -934,13 +934,13 @@  discard block
 block discarded – undo
934 934
         self::$status = $response->ok;
935 935
         self::$pure_response = $response;
936 936
         if (!$response->ok) {
937
-            logger::write("Telegram $name method failed : " . json_encode($response), loggerTypes::WARNING);
937
+            logger::write("Telegram $name method failed : ".json_encode($response), loggerTypes::WARNING);
938 938
             return new responseError($response);
939 939
         }
940
-        return self::methodReturn($name,$response);
940
+        return self::methodReturn($name, $response);
941 941
     }
942 942
 
943
-    private static function cleanArguments (array &$arguments): void {
943
+    private static function cleanArguments(array &$arguments): void {
944 944
         foreach ($arguments as $key => $argument) {
945 945
             if ($argument == [] || $argument === null) {
946 946
                 unset($arguments[$key]);
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
      *
956 956
      * @return int|string|bool
957 957
      */
958
-    public static function catchFields (string $field): int|string|bool {
958
+    public static function catchFields(string $field): int | string | bool {
959 959
         switch ($field) {
960 960
             case fields::CHAT_ID :
961 961
             case fields::FROM_CHAT_ID :
@@ -1102,13 +1102,13 @@  discard block
 block discarded – undo
1102 1102
                     default => false
1103 1103
                 };
1104 1104
             case fields::URL :
1105
-                return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
1105
+                return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
1106 1106
             default:
1107 1107
                 return false;
1108 1108
         }
1109 1109
     }
1110 1110
 
1111
-    public static function fileLink (string|null $file_id = null): bool|string {
1111
+    public static function fileLink(string | null $file_id = null): bool | string {
1112 1112
         $file = request::getFile($file_id);
1113 1113
         if (!isset($file->file_path)) {
1114 1114
             return false;
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
      *
1131 1131
      * @return bool
1132 1132
      */
1133
-    public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool {
1133
+    public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool {
1134 1134
         return tools::downloadFile(self::fileLink($file_id), $destination);
1135 1135
     }
1136 1136
 
@@ -1148,10 +1148,10 @@  discard block
 block discarded – undo
1148 1148
      *
1149 1149
      * @return message|bool|responseError
1150 1150
      */
1151
-    public static function sendFile (string $file_id, int|string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup|replyKeyboardMarkup|replyKeyboardRemove|forceReply|stdClass|array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message|bool|responseError {
1151
+    public static function sendFile(string $file_id, int | string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup | replyKeyboardMarkup | replyKeyboardRemove | forceReply | stdClass | array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message | bool | responseError {
1152 1152
         $type = tools::fileType($file_id);
1153 1153
         return match ($type) {
1154
-            fileTypes::VIDEO => request::sendVideo($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false,null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer),
1154
+            fileTypes::VIDEO => request::sendVideo($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer),
1155 1155
             fileTypes::VIDEO_NOTE => request::sendVideoNote($file_id, $chat_id, $message_thread_id, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer),
1156 1156
             fileTypes::ANIMATION => request::sendAnimation($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer),
1157 1157
             fileTypes::AUDIO => request::sendAudio($file_id, $chat_id, $message_thread_id, $caption, $parse_mode, $caption_entities, null, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer),
Please login to merge, or discard this patch.
src/BPT.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
  * @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.
291 291
  * @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.
292 292
  */
293
-class BPT extends telegram{
293
+class BPT extends telegram {
294 294
     public static update $update;
295 295
 
296 296
     public static BPT $handler;
297 297
 
298 298
 
299
-    public function __construct (array|stdClass $settings) {
299
+    public function __construct(array | stdClass $settings) {
300 300
         static::$handler = &$this;
301 301
         settings::init($settings);
302 302
     }
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     }
307 307
 
308 308
     #[NoReturn]
309
-    public static function exit (string|null $message = null) {
309
+    public static function exit (string | null $message = null) {
310 310
         die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>");
311 311
     }
312 312
 }
Please login to merge, or discard this patch.
src/receiver/multi/exec.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @internal Only for BPT self usage , Don't use it in your source!
19 19
      */
20
-    public static function init(): string|null {
20
+    public static function init(): string | null {
21 21
         return self::getUpdate();
22 22
     }
23 23
 
24
-    private static function getUpdate (): string|null {
24
+    private static function getUpdate(): string | null {
25 25
         $up = glob('*.update');
26 26
         if (!isset($up[0])) {
27
-            logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
27
+            logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING);
28 28
             BPT::exit();
29 29
         }
30 30
         $up = end($up);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     }
55 55
 
56 56
     private static function create($file) {
57
-        file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php ' . $file . ' > /dev/null &");');
57
+        file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php '.$file.' > /dev/null &");');
58 58
     }
59 59
 
60 60
     #[ArrayShape(['url' => "array|string|string[]", 'file' => "string"])]
Please login to merge, or discard this patch.
src/receiver/multi/curl.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * curl class , for multiprocessing with curl tricks
15 15
  */
16 16
 class curl extends webhook {
17
-    public static function init (): string|null {
17
+    public static function init(): string | null {
18 18
         if (!self::checkIP()) {
19
-            logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
19
+            logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING);
20 20
             BPT::exit();
21 21
         }
22 22
         return self::getUpdate();
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR'];
27 27
     }
28 28
 
29
-    private static function getUpdate (): string {
29
+    private static function getUpdate(): string {
30 30
         $input = json_decode(file_get_contents("php://input"), true);
31 31
         webhook::telegramVerify($input['ip']);
32 32
         return $input['update'];
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         lock::set('BPT-MULTI-CURL');
44 44
     }
45 45
 
46
-    private static function getTimeout($url): float|int {
46
+    private static function getTimeout($url): float | int {
47 47
         $times = [];
48
-        for ($i = 0; $i < 10; $i ++) {
48
+        for ($i = 0; $i < 10; $i++) {
49 49
             $ch = curl_init($url);
50 50
             curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_TIMEOUT_MS => 100, CURLOPT_NOBODY => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => 100, CURLOPT_HTTPHEADER => ['accept: application/json', 'content-type: application/json']]);
51 51
             $start = microtime(true);
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
         return $timeout > 50 ? $timeout + 10 : 50;
57 57
     }
58 58
 
59
-    private static function create($file,$timeout) {
60
-        file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\'' . $file . '\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => ' . $timeout . ', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => ' . $timeout . ', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>');
59
+    private static function create($file, $timeout) {
60
+        file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\''.$file.'\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => '.$timeout.', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => '.$timeout.', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>');
61 61
     }
62 62
 
63 63
     #[ArrayShape(['url' => "array|string|string[]", 'file' => "array|string|string[]"])]
Please login to merge, or discard this patch.
src/receiver/webhook.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @internal Only for BPT self usage , Don't use it in your source!
21 21
      */
22
-    public static function init () {
22
+    public static function init() {
23 23
         if (settings::$multi) {
24 24
             multi::init();
25 25
         }
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
         lock::deleteIfExist(['BPT-MULTI-EXEC', 'BPT-MULTI-CURL', 'getUpdate', 'getUpdateHook']);
40 40
     }
41 41
 
42
-    protected static function setWebhook(string $url,string $secret = '') {
42
+    protected static function setWebhook(string $url, string $secret = '') {
43 43
         $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);
44 44
         if (!BPT::$status) {
45
-            logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
46
-            BPT::exit(print_r($res,true));
45
+            logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR);
46
+            BPT::exit(print_r($res, true));
47 47
         }
48
-        logger::write('Webhook was set successfully',loggerTypes::INFO);
48
+        logger::write('Webhook was set successfully', loggerTypes::INFO);
49 49
     }
50 50
 
51 51
     protected static function checkURL() {
52 52
         if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) {
53
-            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR);
53
+            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR);
54 54
             throw new bptException('WEBHOOK_NEED_URL');
55 55
         }
56 56
     }
57 57
 
58 58
     protected static function setURL(): string {
59 59
         if (isset($_GET['token'])) {
60
-            logger::write("You can not specify token in url",loggerTypes::ERROR);
60
+            logger::write("You can not specify token in url", loggerTypes::ERROR);
61 61
             BPT::exit("You can not specify token in url");
62 62
         }
63
-        return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
63
+        return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
64 64
     }
65 65
 
66 66
     protected static function setCertificate() {
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
         self::checkURL();
76 76
         self::setCertificate();
77 77
         $url = self::setURL();
78
-        $secret = !empty(settings::$secret) ? settings::$secret : str_replace(':','---',settings::$token);
79
-        self::setWebhook($url,$secret);
78
+        $secret = !empty(settings::$secret) ? settings::$secret : str_replace(':', '---', settings::$token);
79
+        self::setWebhook($url, $secret);
80 80
         lock::save('BPT-HOOK', md5($secret));
81 81
         BPT::exit('Done');
82 82
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     private static function checkSecret() {
85 85
         $secret_hash = lock::read('BPT-HOOK');
86 86
         if ($secret_hash !== md5(self::getSecret())) {
87
-            logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING);
87
+            logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING);
88 88
             self::processSetWebhook();
89 89
         }
90 90
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return bool
107 107
      */
108
-    public static function fastClose (int $timeout = 86400): bool {
108
+    public static function fastClose(int $timeout = 86400): bool {
109 109
         if (settings::$multi || !lock::exist('BPT-HOOK') || settings::$receiver !== \BPT\constants\receiver::WEBHOOK) {
110 110
             return false;
111 111
         }
Please login to merge, or discard this patch.