Passed
Push — main ( 36dc31...e0778d )
by Miaad
10:46
created
src/types/poll.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,28 +55,28 @@
 block discarded – undo
55 55
      * Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which
56 56
      * are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
57 57
      */
58
-    public null|int $correct_option_id = null;
58
+    public null | int $correct_option_id = null;
59 59
 
60 60
     /**
61 61
      * Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style
62 62
      * poll, 0-200 characters
63 63
      */
64
-    public null|string $explanation = null;
64
+    public null | string $explanation = null;
65 65
 
66 66
     /**
67 67
      * Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
68 68
      * @var messageEntity[]
69 69
      */
70
-    public null|array $explanation_entities = null;
70
+    public null | array $explanation_entities = null;
71 71
 
72 72
     /** Optional. Amount of time in seconds the poll will be active after creation */
73
-    public null|int $open_period = null;
73
+    public null | int $open_period = null;
74 74
 
75 75
     /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */
76
-    public null|int $close_date = null;
76
+    public null | int $close_date = null;
77 77
 
78 78
 
79
-    public function __construct(stdClass|null $object = null) {
79
+    public function __construct(stdClass | null $object = null) {
80 80
         if ($object != null) {
81 81
             parent::__construct($object, self::subs);
82 82
         }
Please login to merge, or discard this patch.
src/types/chatMemberUpdated.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
      * Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events
39 39
      * only.
40 40
      */
41
-    public null|chatInviteLink $invite_link = null;
41
+    public null | chatInviteLink $invite_link = null;
42 42
 
43 43
     /**
44 44
      * Optional. True, if the user joined the chat after sending a direct join request and being approved by an
45 45
      * administrator
46 46
      */
47
-    public null|bool $via_join_request = null;
47
+    public null | bool $via_join_request = null;
48 48
 
49 49
     /** Optional. True, if the user joined the chat via a chat folder invite link */
50
-    public null|bool $via_chat_folder_invite_link = null;
50
+    public null | bool $via_chat_folder_invite_link = null;
51 51
 
52 52
 
53
-    public function __construct(stdClass|null $object = null) {
53
+    public function __construct(stdClass | null $object = null) {
54 54
         if ($object != null) {
55 55
             parent::__construct($object, self::subs);
56 56
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return bool
81 81
      */
82
-    public function isMe (): bool {
82
+    public function isMe(): bool {
83 83
         return $this->new_chat_member->user->id == settings::$bot_id;
84 84
     }
85 85
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      *
116 116
      * @return bool
117 117
      */
118
-    public function isLeaved (): bool {
118
+    public function isLeaved(): bool {
119 119
         return $this->new_chat_member->status === chatMemberStatus::LEFT;
120 120
     }
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @return bool
126 126
      */
127
-    public function isKicked (): bool {
127
+    public function isKicked(): bool {
128 128
         return $this->new_chat_member->status === chatMemberStatus::KICKED;
129 129
     }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return bool
135 135
      */
136
-    public function isOldAdmin (): bool {
136
+    public function isOldAdmin(): bool {
137 137
         return $this->old_chat_member->status === chatMemberStatus::ADMINISTRATOR;
138 138
     }
139 139
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return bool
144 144
      */
145
-    public function isNewAdmin (): bool {
145
+    public function isNewAdmin(): bool {
146 146
         return $this->new_chat_member->status === chatMemberStatus::ADMINISTRATOR;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
src/telegram/request.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -886,30 +886,30 @@  discard block
 block discarded – undo
886 886
         'getGameHighScores'               => ['BPT\types\gameHighScore']
887 887
     ];
888 888
 
889
-    public static function __callStatic (string $name, array $arguments) {
889
+    public static function __callStatic(string $name, array $arguments) {
890 890
         if (!$action = self::methodAction($name)) {
891
-            logger::write("$name method is not supported",loggerTypes::ERROR);
891
+            logger::write("$name method is not supported", loggerTypes::ERROR);
892 892
             throw new bptException('METHOD_NOT_FOUND');
893 893
         }
894 894
         self::checkArguments($arguments);
895
-        self::keysName($action,$arguments);
896
-        self::readyFile($action,$arguments);
895
+        self::keysName($action, $arguments);
896
+        self::readyFile($action, $arguments);
897 897
         self::cleanArguments($arguments);
898
-        self::setDefaults($action,$arguments);
898
+        self::setDefaults($action, $arguments);
899 899
 
900 900
         if (isset($arguments['answer']) && $arguments['answer'] === true) {
901 901
             unset($arguments['answer']);
902 902
             if (!answer::isAnswered()) {
903
-                return answer::init($action,$arguments);
903
+                return answer::init($action, $arguments);
904 904
             }
905
-            logger::write('you can use answer mode only once for each webhook update, Others will be called like normal',loggerTypes::WARNING);
905
+            logger::write('you can use answer mode only once for each webhook update, Others will be called like normal', loggerTypes::WARNING);
906 906
         }
907
-        $result = curl::init($action,$arguments);
907
+        $result = curl::init($action, $arguments);
908 908
         if (!is_object($result)) {
909
-            logger::write("Telegram $action method failed : " . $result, loggerTypes::WARNING);
909
+            logger::write("Telegram $action method failed : ".$result, loggerTypes::WARNING);
910 910
             return false;
911 911
         }
912
-        return self::processResponse($action,$result);
912
+        return self::processResponse($action, $result);
913 913
     }
914 914
 
915 915
     private static function checkArguments(array &$arguments): void {
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
         }
919 919
     }
920 920
 
921
-    private static function keysName (string $name, array &$arguments): void {
921
+    private static function keysName(string $name, array &$arguments): void {
922 922
         foreach ($arguments as $key => $argument) {
923 923
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
924 924
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
         }
928 928
     }
929 929
 
930
-    private static function methodAction(string $name): string|false {
930
+    private static function methodAction(string $name): string | false {
931 931
         return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
932 932
     }
933 933
 
@@ -963,11 +963,11 @@  discard block
 block discarded – undo
963 963
         }
964 964
     }
965 965
 
966
-    private static function methodFile(string $name): array|false {
966
+    private static function methodFile(string $name): array | false {
967 967
         return self::METHODS_WITH_FILE[$name] ?? false;
968 968
     }
969 969
 
970
-    private static function methodReturn(string $name,stdClass $response) {
970
+    private static function methodReturn(string $name, stdClass $response) {
971 971
         if (!settings::$use_types_classes) {
972 972
             return $response;
973 973
         }
@@ -989,13 +989,13 @@  discard block
 block discarded – undo
989 989
         $defaults = self::METHODS_EXTRA_DEFAULTS[$name] ?? [];
990 990
         foreach ($defaults as $key => $default) {
991 991
             if (is_numeric($key)) {
992
-                if (!isset($arguments[$default])){
992
+                if (!isset($arguments[$default])) {
993 993
                     $arguments[$default] = self::catchFields($default);
994 994
                 }
995 995
             }
996 996
             elseif (isset(BPT::$update->{$key}) || $key === 'other') {
997 997
                 foreach ($default as $def) {
998
-                    if (!isset($arguments[$def])){
998
+                    if (!isset($arguments[$def])) {
999 999
                         $arguments[$def] = self::catchFields($def);
1000 1000
                     }
1001 1001
                 }
@@ -1014,14 +1014,14 @@  discard block
 block discarded – undo
1014 1014
         self::$status = $response->ok;
1015 1015
         self::$pure_response = $response;
1016 1016
         if (!$response->ok) {
1017
-            logger::write("Telegram $name method failed : " . json_encode($response), loggerTypes::WARNING);
1017
+            logger::write("Telegram $name method failed : ".json_encode($response), loggerTypes::WARNING);
1018 1018
             unset($response->ok);
1019 1019
             return new responseError($response);
1020 1020
         }
1021
-        return self::methodReturn($name,$response);
1021
+        return self::methodReturn($name, $response);
1022 1022
     }
1023 1023
 
1024
-    private static function cleanArguments (array &$arguments): void {
1024
+    private static function cleanArguments(array &$arguments): void {
1025 1025
         foreach ($arguments as $key => $argument) {
1026 1026
             if ($argument == [] || $argument === null) {
1027 1027
                 unset($arguments[$key]);
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
      *
1037 1037
      * @return int|string|bool
1038 1038
      */
1039
-    public static function catchFields (string $field): int|string|bool {
1039
+    public static function catchFields(string $field): int | string | bool {
1040 1040
         switch ($field) {
1041 1041
             case fields::CHAT_ID :
1042 1042
             case fields::FROM_CHAT_ID :
@@ -1183,13 +1183,13 @@  discard block
 block discarded – undo
1183 1183
                     default => false
1184 1184
                 };
1185 1185
             case fields::URL :
1186
-                return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
1186
+                return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
1187 1187
             default:
1188 1188
                 return false;
1189 1189
         }
1190 1190
     }
1191 1191
 
1192
-    public static function fileLink (string|null $file_id = null): bool|string {
1192
+    public static function fileLink(string | null $file_id = null): bool | string {
1193 1193
         $file = request::getFile($file_id);
1194 1194
         if (!isset($file->file_path)) {
1195 1195
             return false;
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
      *
1212 1212
      * @return bool
1213 1213
      */
1214
-    public static function downloadFile (string $destination, string|null $file_id = null): bool {
1214
+    public static function downloadFile(string $destination, string | null $file_id = null): bool {
1215 1215
         return tools::downloadFile(self::fileLink($file_id), $destination);
1216 1216
     }
1217 1217
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
      *
1230 1230
      * @return message|bool|responseError
1231 1231
      */
1232
-    public static function sendFile (string $file_id, int|string $chat_id = null, string|null $business_connection_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, array|object $reply_parameters = null, inlineKeyboardMarkup|replyKeyboardMarkup|replyKeyboardRemove|forceReply|stdClass|array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null, int|null $reply_to_message_id = null, bool|null $allow_sending_without_reply = null): message|bool|responseError {
1232
+    public static function sendFile(string $file_id, int | string $chat_id = null, string | null $business_connection_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, array | object $reply_parameters = null, inlineKeyboardMarkup | replyKeyboardMarkup | replyKeyboardRemove | forceReply | stdClass | array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null, int | null $reply_to_message_id = null, bool | null $allow_sending_without_reply = null): message | bool | responseError {
1233 1233
         $type = tools::fileType($file_id);
1234 1234
         return match ($type) {
1235 1235
             fileTypes::VIDEO => request::sendVideo(video: $file_id, chat_id: $chat_id, business_connection_id: $business_connection_id, message_thread_id: $message_thread_id, caption: $caption, parse_mode: $parse_mode, caption_entities: $caption_entities, has_spoiler: false, disable_notification: $disable_notification, protect_content: $protect_content, reply_parameters: $reply_parameters, reply_markup: $reply_markup, token: $token, forgot: $forgot, answer: $answer, reply_to_message_id: $reply_to_message_id, allow_sending_without_reply: $allow_sending_without_reply),
Please login to merge, or discard this patch.