Passed
Push — main ( b2c2ea...1a254f )
by Miaad
01:42
created
src/logger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  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 (int $log_size = 10): void {
20
+    public static function init(int $log_size = 10): void {
21 21
         self::$log_size = $log_size;
22 22
         $log_file = realpath(settings::$name.'BPT.log');
23 23
         if (file_exists($log_file) && !(filesize($log_file) > self::$log_size * 1024 * 1024)) {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         self::$handler = fopen(settings::$name.'BPT.log', $mode);
32 32
 
33 33
         if ($write) {
34
-            fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n");
34
+            fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n");
35 35
         }
36 36
 
37 37
         if (self::$waited_logs != []) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @return void
53 53
      */
54 54
     public static function write(string $data, string $type = loggerTypes::NONE): void {
55
-        $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" );
55
+        $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n");
56 56
         if (!is_null(self::$handler)) {
57 57
             fwrite(self::$handler, $text);
58 58
         }
Please login to merge, or discard this patch.
examples/messenger/bot.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 use BPT\database\mysql;
6 6
 use BPT\types\message;
7 7
 
8
-if (file_exists('vendor/autoload.php')){
8
+if (file_exists('vendor/autoload.php')) {
9 9
     require 'vendor/autoload.php';
10 10
 }
11
-else{
12
-    if(!file_exists('BPT.phar')) {
11
+else {
12
+    if (!file_exists('BPT.phar')) {
13 13
         copy('https://dl.bptlib.ir/BPT.phar', 'BPT.phar');
14 14
     }
15 15
     require 'BPT.phar';
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
     const SEND_FAILED = 'Failed!';
36 36
     const SEND_SUCCESSFUL = 'Done!';
37 37
 
38
-    public function __construct(array $settings){
38
+    public function __construct(array $settings) {
39 39
         parent::__construct($settings);
40 40
     }
41 41
 
42
-    public function message(message $update){
42
+    public function message(message $update) {
43 43
         $text = $update->text ?? '';
44 44
         $user_id = $update->from->id;
45 45
 
46 46
         if ($text === '/start') {
47
-            $this->sendMessage(self::START_TEXT,answer: true);
47
+            $this->sendMessage(self::START_TEXT, answer: true);
48 48
         }
49 49
         else {
50 50
             /** You could use both style */
@@ -56,21 +56,21 @@  discard block
 block discarded – undo
56 56
                     $this->sendMessage(self::HELP, answer: true);
57 57
                 }
58 58
                 elseif ($text === '/reply_on') {
59
-                    mysql::update('users',['value'=>'reply_on'],['id'=>$user_id],1);
59
+                    mysql::update('users', ['value'=>'reply_on'], ['id'=>$user_id], 1);
60 60
                     $this->sendMessage(self::REPLY_ON, answer: true);
61 61
                 }
62 62
                 elseif ($text === '/reply_off') {
63
-                    mysql::update('users',['value'=>'reply_off'],['id'=>$user_id],1);
63
+                    mysql::update('users', ['value'=>'reply_off'], ['id'=>$user_id], 1);
64 64
                     $this->sendMessage(self::REPLY_OFF, answer: true);
65 65
                 }
66 66
                 elseif (isset($update->reply_to_message)) {
67 67
                     $reply_message_id = $update->reply_to_message->message_id;
68 68
 
69 69
                     if ($update->reply_to_message->from->id === $user_id) {
70
-                        $check_message = mysql::select('messages', ['receiver_message_id','receiver_id'], [
70
+                        $check_message = mysql::select('messages', ['receiver_message_id', 'receiver_id'], [
71 71
                             'sender_message_id' => $reply_message_id,
72 72
                             'sender_id'         => $user_id
73
-                        ],1);
73
+                        ], 1);
74 74
 
75 75
                         if ($check_message->num_rows > 0) {
76 76
                             $data = $check_message->fetch_object();
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
                         }
84 84
                     }
85 85
                     else {
86
-                        $data = mysql::select('messages', ['sender_message_id','sender_id'], [
86
+                        $data = mysql::select('messages', ['sender_message_id', 'sender_id'], [
87 87
                             'receiver_message_id' => $reply_message_id,
88 88
                             'receiver_id'         => $user_id
89
-                        ],1)->fetch_object();
89
+                        ], 1)->fetch_object();
90 90
 
91
-                        $value = mysql::select('users','value',['id'=>$user_id])->fetch_object()->value;
91
+                        $value = mysql::select('users', 'value', ['id'=>$user_id])->fetch_object()->value;
92 92
                         $receiver_id = $data->sender_id;
93 93
                         if ($value === 'reply_on') {
94
-                            mysql::update('users',['value'=>''],['id'=>$user_id]);
94
+                            mysql::update('users', ['value'=>''], ['id'=>$user_id]);
95 95
                             $result = $this->copyMessage($receiver_id, reply_to_message_id: $data->sender_message_id);
96 96
                         }
97 97
                         else {
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 
102 102
                     if (self::$status) {
103 103
                         mysql::insert('messages',
104
-                            ['sender_message_id','sender_id','receiver_message_id','receiver_id'],
105
-                            [$message_id,$user_id,$result->message_id,$receiver_id]
104
+                            ['sender_message_id', 'sender_id', 'receiver_message_id', 'receiver_id'],
105
+                            [$message_id, $user_id, $result->message_id, $receiver_id]
106 106
                         );
107 107
                         if (self::SHOW_STATUS) {
108 108
                             $this->sendMessage(self::SEND_SUCCESSFUL, answer: true);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             else {
117 117
                 $username = $update->from->username;
118 118
                 if (empty($username)) {
119
-                    $name = $update->from->first_name . (!empty($update->from->last_name) ? (' ' . $update->from->last_name) : '');
119
+                    $name = $update->from->first_name.(!empty($update->from->last_name) ? (' '.$update->from->last_name) : '');
120 120
                     $keyboard = [
121 121
                         'inline_keyboard' => [
122 122
                             [
@@ -154,33 +154,33 @@  discard block
 block discarded – undo
154 154
                 }
155 155
                 if (isset($update->reply_to_message)) {
156 156
                     $reply_message_id = $update->reply_to_message->message_id;
157
-                    if ($update->reply_to_message->from->id === $user_id){
157
+                    if ($update->reply_to_message->from->id === $user_id) {
158 158
                         $check_message = mysql::select('messages', 'receiver_message_id', [
159 159
                             'sender_message_id' => $reply_message_id,
160 160
                             'sender_id'         => $user_id
161
-                        ],1);
161
+                        ], 1);
162 162
                         if ($check_message->num_rows > 0) {
163
-                            $result = $this->copyMessage(self::ADMIN, reply_to_message_id: $check_message->fetch_object()->receiver_message_id,reply_markup: $keyboard);
163
+                            $result = $this->copyMessage(self::ADMIN, reply_to_message_id: $check_message->fetch_object()->receiver_message_id, reply_markup: $keyboard);
164 164
                         }
165 165
                         else {
166
-                            $result = $this->copyMessage(self::ADMIN,reply_markup: $keyboard);
166
+                            $result = $this->copyMessage(self::ADMIN, reply_markup: $keyboard);
167 167
                         }
168 168
                     }
169 169
                     else {
170 170
                         $check_message = mysql::select('messages', 'sender_message_id', [
171 171
                             'receiver_message_id' => $reply_message_id,
172 172
                             'receiver_id'         => $user_id
173
-                        ],1);
173
+                        ], 1);
174 174
                         if ($check_message->num_rows > 0) {
175
-                            $result = $this->copyMessage(self::ADMIN, reply_to_message_id: $check_message->fetch_object()->sender_message_id,reply_markup: $keyboard);
175
+                            $result = $this->copyMessage(self::ADMIN, reply_to_message_id: $check_message->fetch_object()->sender_message_id, reply_markup: $keyboard);
176 176
                         }
177 177
                         else {
178
-                            $result = $this->copyMessage(self::ADMIN,reply_markup: $keyboard);
178
+                            $result = $this->copyMessage(self::ADMIN, reply_markup: $keyboard);
179 179
                         }
180 180
                     }
181 181
                 }
182 182
                 else {
183
-                    $result = $this->copyMessage(self::ADMIN,reply_markup: $keyboard);
183
+                    $result = $this->copyMessage(self::ADMIN, reply_markup: $keyboard);
184 184
                 }
185 185
 
186 186
                 /**
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
                  */
190 190
                 if (self::$status) {
191 191
                     mysql::insert('messages',
192
-                        ['sender_message_id','sender_id','receiver_message_id','receiver_id'],
193
-                        [$message_id,$user_id,$result->message_id,self::ADMIN]
192
+                        ['sender_message_id', 'sender_id', 'receiver_message_id', 'receiver_id'],
193
+                        [$message_id, $user_id, $result->message_id, self::ADMIN]
194 194
                     );
195 195
                     if (self::SHOW_STATUS) {
196 196
                         $this->sendMessage(self::SEND_SUCCESSFUL, answer: true);
Please login to merge, or discard this patch.
src/types/user.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,37 +21,37 @@  discard block
 block discarded – undo
21 21
     public int $id;
22 22
 
23 23
     /** True, if this user is a bot */
24
-    public null|bool $is_bot = null;
24
+    public null | bool $is_bot = null;
25 25
 
26 26
     /** User's or bot's first name */
27
-    public null|string $first_name = null;
27
+    public null | string $first_name = null;
28 28
 
29 29
     /** Optional. User's or bot's last name */
30
-    public null|string $last_name = null;
30
+    public null | string $last_name = null;
31 31
 
32 32
     /** Optional. User's or bot's username */
33
-    public null|string $username = null;
33
+    public null | string $username = null;
34 34
 
35 35
     /** Optional. IETF language tag of the user's language */
36
-    public null|string $language_code = null;
36
+    public null | string $language_code = null;
37 37
 
38 38
     /** Optional. True, if this user is a Telegram Premium user */
39
-    public null|bool $is_premium = null;
39
+    public null | bool $is_premium = null;
40 40
 
41 41
     /** Optional. True, if this user added the bot to the attachment menu */
42
-    public null|bool $added_to_attachment_menu = null;
42
+    public null | bool $added_to_attachment_menu = null;
43 43
 
44 44
     /** Optional. True, if the bot can be invited to groups. Returned only in getMe. */
45
-    public null|bool $can_join_groups = null;
45
+    public null | bool $can_join_groups = null;
46 46
 
47 47
     /** Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. */
48
-    public null|bool $can_read_all_group_messages = null;
48
+    public null | bool $can_read_all_group_messages = null;
49 49
 
50 50
     /** Optional. True, if the bot supports inline queries. Returned only in getMe. */
51
-    public null|bool $supports_inline_queries = null;
51
+    public null | bool $supports_inline_queries = null;
52 52
 
53 53
 
54
-    public function __construct(stdClass|null $object = null) {
54
+    public function __construct(stdClass | null $object = null) {
55 55
         if ($object != null) {
56 56
             parent::__construct($object, self::subs);
57 57
         }
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     }
63 63
 
64 64
     public function fullName(bool $nameFirst = true): string {
65
-        return trim($nameFirst ? $this->first_name . ' ' . $this->last_name : $this->last_name . ' ' . $this->first_name);
65
+        return trim($nameFirst ? $this->first_name.' '.$this->last_name : $this->last_name.' '.$this->first_name);
66 66
     }
67 67
 
68
-    public function getProfiles(int|null $offset = null, int|null $limit = null): userProfilePhotos|responseError {
69
-        return telegram::getUserProfilePhotos($this->id,$offset,$limit);
68
+    public function getProfiles(int | null $offset = null, int | null $limit = null): userProfilePhotos | responseError {
69
+        return telegram::getUserProfilePhotos($this->id, $offset, $limit);
70 70
     }
71 71
 }
Please login to merge, or discard this patch.
src/types/chat.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -30,85 +30,85 @@  discard block
 block discarded – undo
30 30
     public string $type;
31 31
 
32 32
     /** Optional. Title, for supergroups, channels and group chats */
33
-    public null|string $title = null;
33
+    public null | string $title = null;
34 34
 
35 35
     /** Optional. Username, for private chats, supergroups and channels if available */
36
-    public null|string $username = null;
36
+    public null | string $username = null;
37 37
 
38 38
     /** Optional. First name of the other party in a private chat */
39
-    public null|string $first_name = null;
39
+    public null | string $first_name = null;
40 40
 
41 41
     /** Optional. Last name of the other party in a private chat */
42
-    public null|string $last_name = null;
42
+    public null | string $last_name = null;
43 43
 
44 44
     /** Optional. True, if the supergroup chat is a forum (has topics enabled) */
45
-    public null|bool $is_forum = null;
45
+    public null | bool $is_forum = null;
46 46
 
47 47
     /** Optional. Chat photo. Returned only in getChat. */
48
-    public null|chatPhoto $photo = null;
48
+    public null | chatPhoto $photo = null;
49 49
 
50 50
     /** Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */
51
-    public null|array $active_usernames = null;
51
+    public null | array $active_usernames = null;
52 52
 
53 53
     /** Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
54
-    public null|string $emoji_status_custom_emoji_id = null;
54
+    public null | string $emoji_status_custom_emoji_id = null;
55 55
 
56 56
     /** Optional. Bio of the other party in a private chat. Returned only in getChat. */
57
-    public null|string $bio = null;
57
+    public null | string $bio = null;
58 58
 
59 59
     /**
60 60
      * Optional. True, if privacy settings of the other party in the private chat allows to use
61 61
      * tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
62 62
      */
63
-    public null|bool $has_private_forwards = null;
63
+    public null | bool $has_private_forwards = null;
64 64
 
65 65
     /**
66 66
      * Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in
67 67
      * the private chat. Returned only in getChat.
68 68
      */
69
-    public null|bool $has_restricted_voice_and_video_messages = null;
69
+    public null | bool $has_restricted_voice_and_video_messages = null;
70 70
 
71 71
     /** Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
72
-    public null|bool $join_to_send_messages = null;
72
+    public null | bool $join_to_send_messages = null;
73 73
 
74 74
     /**
75 75
      * Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators.
76 76
      * Returned only in getChat.
77 77
      */
78
-    public null|bool $join_by_request = null;
78
+    public null | bool $join_by_request = null;
79 79
 
80 80
     /** Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. */
81
-    public null|string $description = null;
81
+    public null | string $description = null;
82 82
 
83 83
     /** Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
84
-    public null|string $invite_link = null;
84
+    public null | string $invite_link = null;
85 85
 
86 86
     /** Optional. The most recent pinned message (by sending date). Returned only in getChat. */
87
-    public null|message $pinned_message = null;
87
+    public null | message $pinned_message = null;
88 88
 
89 89
     /** Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. */
90
-    public null|chatPermissions $permissions = null;
90
+    public null | chatPermissions $permissions = null;
91 91
 
92 92
     /**
93 93
      * Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged
94 94
      * user; in seconds. Returned only in getChat.
95 95
      */
96
-    public null|int $slow_mode_delay = null;
96
+    public null | int $slow_mode_delay = null;
97 97
 
98 98
     /**
99 99
      * Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds.
100 100
      * Returned only in getChat.
101 101
      */
102
-    public null|int $message_auto_delete_time = null;
102
+    public null | int $message_auto_delete_time = null;
103 103
 
104 104
     /** Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */
105
-    public null|bool $has_protected_content = null;
105
+    public null | bool $has_protected_content = null;
106 106
 
107 107
     /** Optional. For supergroups, name of group sticker set. Returned only in getChat. */
108
-    public null|string $sticker_set_name = null;
108
+    public null | string $sticker_set_name = null;
109 109
 
110 110
     /** Optional. True, if the bot can change the group sticker set. Returned only in getChat. */
111
-    public null|bool $can_set_sticker_set = null;
111
+    public null | bool $can_set_sticker_set = null;
112 112
 
113 113
     /**
114 114
      * Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
@@ -116,87 +116,87 @@  discard block
 block discarded – undo
116 116
      * languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed
117 117
      * 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
118 118
      */
119
-    public null|int $linked_chat_id = null;
119
+    public null | int $linked_chat_id = null;
120 120
 
121 121
     /** Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
122
-    public null|chatLocation $location = null;
122
+    public null | chatLocation $location = null;
123 123
 
124 124
 
125
-    public function __construct(stdClass|null $object = null) {
125
+    public function __construct(stdClass | null $object = null) {
126 126
         if ($object != null) {
127 127
             parent::__construct($object, self::subs);
128 128
         }
129 129
     }
130 130
 
131
-    public function isPrivate (): bool {
131
+    public function isPrivate(): bool {
132 132
         return $this->type === chatType::PRIVATE;
133 133
     }
134 134
 
135
-    public function isGroup (): bool {
135
+    public function isGroup(): bool {
136 136
         return $this->type === chatType::GROUP;
137 137
     }
138 138
 
139
-    public function isSuperGroup (): bool {
139
+    public function isSuperGroup(): bool {
140 140
         return $this->type === chatType::SUPERGROUP;
141 141
     }
142 142
 
143
-    public function isChannel (): bool {
143
+    public function isChannel(): bool {
144 144
         return $this->type === chatType::CHANNEL;
145 145
     }
146 146
 
147
-    public function leave(): responseError|bool {
147
+    public function leave(): responseError | bool {
148 148
         if ($this->isPrivate()) {
149 149
             return false;
150 150
         }
151 151
         return telegram::leave($this->id);
152 152
     }
153 153
 
154
-    public function setPhoto(CURLFile|array $photo): responseError|bool {
154
+    public function setPhoto(CURLFile | array $photo): responseError | bool {
155 155
         if ($this->isPrivate()) {
156 156
             return false;
157 157
         }
158
-        return telegram::setChatPhoto($photo,$this->id);
158
+        return telegram::setChatPhoto($photo, $this->id);
159 159
     }
160 160
 
161
-    public function delPhoto(): responseError|bool {
161
+    public function delPhoto(): responseError | bool {
162 162
         if ($this->isPrivate()) {
163 163
             return false;
164 164
         }
165 165
         return telegram::deleteChatPhoto($this->id);
166 166
     }
167 167
 
168
-    public function setTitle(string|array $title): responseError|bool {
168
+    public function setTitle(string | array $title): responseError | bool {
169 169
         if ($this->isPrivate()) {
170 170
             return false;
171 171
         }
172
-        return telegram::setChatTitle($title,$this->id);
172
+        return telegram::setChatTitle($title, $this->id);
173 173
     }
174 174
 
175
-    public function setDescription(string|null $description = null): responseError|bool {
175
+    public function setDescription(string | null $description = null): responseError | bool {
176 176
         if ($this->isPrivate()) {
177 177
             return false;
178 178
         }
179
-        return telegram::setChatDescription($this->id,$description);
179
+        return telegram::setChatDescription($this->id, $description);
180 180
     }
181 181
 
182
-    public function getAdmins(): bool|responseError|array {
182
+    public function getAdmins(): bool | responseError | array {
183 183
         if ($this->isPrivate()) {
184 184
             return false;
185 185
         }
186 186
         return telegram::getChatAdministrators($this->id);
187 187
     }
188 188
 
189
-    public function getMembersCount(): bool|responseError|int {
189
+    public function getMembersCount(): bool | responseError | int {
190 190
         if ($this->isPrivate()) {
191 191
             return false;
192 192
         }
193 193
         return telegram::getChatMemberCount($this->id);
194 194
     }
195 195
 
196
-    public function getMember(int|null $user_id = null): chatMember|bool|responseError {
196
+    public function getMember(int | null $user_id = null): chatMember | bool | responseError {
197 197
         if ($this->isPrivate()) {
198 198
             return false;
199 199
         }
200
-        return telegram::getChatMember($this->id,$user_id);
200
+        return telegram::getChatMember($this->id, $user_id);
201 201
     }
202 202
 }
Please login to merge, or discard this patch.
src/types/photoSize.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
     public int $height;
29 29
 
30 30
     /** Optional. File size in bytes */
31
-    public null|int $file_size = null;
31
+    public null | int $file_size = null;
32 32
 
33 33
 
34
-    public function __construct(stdClass|null $object = null) {
34
+    public function __construct(stdClass | null $object = null) {
35 35
         if ($object != null) {
36 36
             parent::__construct($object, self::subs);
37 37
         }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return bool|string string will be returned when destination doesn't set
54 54
      */
55
-    public function download(string|null $destination = null): bool|string {
56
-        return telegram::downloadFile($destination ?? 'unknown.jpg',$this->file_id);
55
+    public function download(string | null $destination = null): bool | string {
56
+        return telegram::downloadFile($destination ?? 'unknown.jpg', $this->file_id);
57 57
     }
58 58
 
59 59
     public function link(): string {
Please login to merge, or discard this patch.
src/types/chatPhoto.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public string $big_file_unique_id;
38 38
 
39 39
 
40
-    public function __construct(stdClass|null $object = null) {
40
+    public function __construct(stdClass | null $object = null) {
41 41
         if ($object != null) {
42 42
             parent::__construct($object, self::subs);
43 43
         }
@@ -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 $big = true): bool|string {
63
-        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$big ? $this->big_file_id : $this->small_file_id);
62
+    public function download(string | null $destination = null, bool $big = true): bool | string {
63
+        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $big ? $this->big_file_id : $this->small_file_id);
64 64
     }
65 65
 
66 66
     public function link(bool $big = true): string {
Please login to merge, or discard this patch.
src/types/audio.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,29 +25,29 @@  discard block
 block discarded – undo
25 25
     public int $duration;
26 26
 
27 27
     /** Optional. Performer of the audio as defined by sender or by audio tags */
28
-    public null|string $performer = null;
28
+    public null | string $performer = null;
29 29
 
30 30
     /** Optional. Title of the audio as defined by sender or by audio tags */
31
-    public null|string $title = null;
31
+    public null | string $title = null;
32 32
 
33 33
     /** Optional. Original filename as defined by sender */
34
-    public null|string $file_name = null;
34
+    public null | string $file_name = null;
35 35
 
36 36
     /** Optional. MIME type of the file as defined by sender */
37
-    public null|string $mime_type = null;
37
+    public null | string $mime_type = null;
38 38
 
39 39
     /**
40 40
      * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
41 41
      * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
42 42
      * integer or double-precision float type are safe for storing this value.
43 43
      */
44
-    public null|int $file_size = null;
44
+    public null | int $file_size = null;
45 45
 
46 46
     /** Optional. Thumbnail of the album cover to which the music file belongs */
47
-    public null|photoSize $thumb = null;
47
+    public null | photoSize $thumb = null;
48 48
 
49 49
 
50
-    public function __construct(stdClass|null $object = null) {
50
+    public function __construct(stdClass | null $object = null) {
51 51
         if ($object != null) {
52 52
             parent::__construct($object, self::subs);
53 53
         }
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @return bool|string string will be returned when destination doesn't set
70 70
      */
71
-    public function download(string|null $destination = null): bool|string {
72
-        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3',$this->file_id);
71
+    public function download(string | null $destination = null): bool | string {
72
+        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3', $this->file_id);
73 73
     }
74 74
 
75 75
     public function link(): string {
Please login to merge, or discard this patch.
src/types/chatInviteLink.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,28 +31,28 @@
 block discarded – undo
31 31
     public bool $is_revoked;
32 32
 
33 33
     /** Optional. Invite link name */
34
-    public null|string $name = null;
34
+    public null | string $name = null;
35 35
 
36 36
     /** Optional. Point in time (Unix timestamp) when the link will expire or has been expired */
37
-    public null|int $expire_date = null;
37
+    public null | int $expire_date = null;
38 38
 
39 39
     /**
40 40
      * Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat
41 41
      * via this invite link; 1-99999
42 42
      */
43
-    public null|int $member_limit = null;
43
+    public null | int $member_limit = null;
44 44
 
45 45
     /** Optional. Number of pending join requests created using this link */
46
-    public null|int $pending_join_request_count = null;
46
+    public null | int $pending_join_request_count = null;
47 47
 
48 48
 
49
-    public function __construct(stdClass|null $object = null) {
49
+    public function __construct(stdClass | null $object = null) {
50 50
         if ($object != null) {
51 51
             parent::__construct($object, self::subs);
52 52
         }
53 53
     }
54 54
 
55
-    public function revoke(): self|responseError|bool {
55
+    public function revoke(): self | responseError | bool {
56 56
         return $this->is_revoked ?? telegram::revokeChatInviteLink($this->invite_link);
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
src/types/message.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
     public int $message_id;
64 64
 
65 65
     /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */
66
-    public null|int $message_thread_id = null;
66
+    public null | int $message_thread_id = null;
67 67
 
68 68
     /**
69 69
      * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field
70 70
      * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
71 71
      */
72
-    public null|user $from = null;
72
+    public null | user $from = null;
73 73
 
74 74
     /**
75 75
      * Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts,
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake
78 78
      * sender user in non-channel chats, if the message was sent on behalf of a chat.
79 79
      */
80
-    public null|chat $sender_chat = null;
80
+    public null | chat $sender_chat = null;
81 81
 
82 82
     /** Date the message was sent in Unix time */
83 83
     public int $date;
@@ -86,185 +86,185 @@  discard block
 block discarded – undo
86 86
     public chat $chat;
87 87
 
88 88
     /** Optional. For forwarded messages, sender of the original message */
89
-    public null|user $forward_from = null;
89
+    public null | user $forward_from = null;
90 90
 
91 91
     /**
92 92
      * Optional. For messages forwarded from channels or from anonymous administrators, information about the
93 93
      * original sender chat
94 94
      */
95
-    public null|chat $forward_from_chat = null;
95
+    public null | chat $forward_from_chat = null;
96 96
 
97 97
     /** Optional. For messages forwarded from channels, identifier of the original message in the channel */
98
-    public null|int $forward_from_message_id = null;
98
+    public null | int $forward_from_message_id = null;
99 99
 
100 100
     /**
101 101
      * Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator,
102 102
      * signature of the message sender if present
103 103
      */
104
-    public null|string $forward_signature = null;
104
+    public null | string $forward_signature = null;
105 105
 
106 106
     /**
107 107
      * Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in
108 108
      * forwarded messages
109 109
      */
110
-    public null|string $forward_sender_name = null;
110
+    public null | string $forward_sender_name = null;
111 111
 
112 112
     /** Optional. For forwarded messages, date the original message was sent in Unix time */
113
-    public null|int $forward_date = null;
113
+    public null | int $forward_date = null;
114 114
 
115 115
     /** Optional. True, if the message is sent to a forum topic */
116
-    public null|bool $is_topic_message = null;
116
+    public null | bool $is_topic_message = null;
117 117
 
118 118
     /**
119 119
      * Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion
120 120
      * group
121 121
      */
122
-    public null|bool $is_automatic_forward = null;
122
+    public null | bool $is_automatic_forward = null;
123 123
 
124 124
     /**
125 125
      * Optional. For replies, the original message. Note that the Message object in this field will not contain
126 126
      * further reply_to_message fields even if it itself is a reply.
127 127
      */
128
-    public null|message $reply_to_message = null;
128
+    public null | message $reply_to_message = null;
129 129
 
130 130
     /** Optional. Bot through which the message was sent */
131
-    public null|user $via_bot = null;
131
+    public null | user $via_bot = null;
132 132
 
133 133
     /** Optional. Date the message was last edited in Unix time */
134
-    public null|int $edit_date = null;
134
+    public null | int $edit_date = null;
135 135
 
136 136
     /** Optional. True, if the message can't be forwarded */
137
-    public null|bool $has_protected_content = null;
137
+    public null | bool $has_protected_content = null;
138 138
 
139 139
     /** Optional. The unique identifier of a media message group this message belongs to */
140
-    public null|string $media_group_id = null;
140
+    public null | string $media_group_id = null;
141 141
 
142 142
     /**
143 143
      * Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group
144 144
      * administrator
145 145
      */
146
-    public null|string $author_signature = null;
146
+    public null | string $author_signature = null;
147 147
 
148 148
     /** Optional. For text messages, the actual UTF-8 text of the message */
149
-    public null|string $text = null;
149
+    public null | string $text = null;
150 150
 
151 151
     /** Optional. If user message was a commend , this parameter will be the commend */
152
-    public string|null $commend = null;
152
+    public string | null $commend = null;
153 153
 
154 154
     /** Optional. If user message was a commend , this parameter will be the commend username(if exist) */
155
-    public string|null $commend_username = null;
155
+    public string | null $commend_username = null;
156 156
 
157 157
     /** Optional. If user message was a commend , this parameter will be the commend payload(if exist) */
158
-    public string|null $commend_payload = null;
158
+    public string | null $commend_payload = null;
159 159
 
160 160
     /**
161 161
      * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
162 162
      * @var messageEntity[]
163 163
      */
164
-    public null|array $entities = null;
164
+    public null | array $entities = null;
165 165
 
166 166
     /**
167 167
      * Optional. Message is an animation, information about the animation. For backward compatibility, when this
168 168
      * field is set, the document field will also be set
169 169
      */
170
-    public null|animation $animation = null;
170
+    public null | animation $animation = null;
171 171
 
172 172
     /** Optional. Message is an audio file, information about the file */
173
-    public null|audio $audio = null;
173
+    public null | audio $audio = null;
174 174
 
175 175
     /** Optional. Message is a general file, information about the file */
176
-    public null|document $document = null;
176
+    public null | document $document = null;
177 177
 
178 178
     /**
179 179
      * Optional. Message is a photo, available sizes of the photo
180 180
      * @var photoSize[]
181 181
      */
182
-    public null|array $photo = null;
182
+    public null | array $photo = null;
183 183
 
184 184
     /** Optional. Message is a sticker, information about the sticker */
185
-    public null|sticker $sticker = null;
185
+    public null | sticker $sticker = null;
186 186
 
187 187
     /** Optional. Message is a video, information about the video */
188
-    public null|video $video = null;
188
+    public null | video $video = null;
189 189
 
190 190
     /** Optional. Message is a video note, information about the video message */
191
-    public null|videoNote $video_note = null;
191
+    public null | videoNote $video_note = null;
192 192
 
193 193
     /** Optional. Message is a voice message, information about the file */
194
-    public null|voice $voice = null;
194
+    public null | voice $voice = null;
195 195
 
196 196
     /** Optional. Caption for the animation, audio, document, photo, video or voice */
197
-    public null|string $caption = null;
197
+    public null | string $caption = null;
198 198
 
199 199
     /**
200 200
      * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
201 201
      * in the caption
202 202
      * @var messageEntity[]
203 203
      */
204
-    public null|array $caption_entities = null;
204
+    public null | array $caption_entities = null;
205 205
 
206 206
     /** Optional. Message is a shared contact, information about the contact */
207
-    public null|contact $contact = null;
207
+    public null | contact $contact = null;
208 208
 
209 209
     /** Optional. Message is a dice with random value */
210
-    public null|dice $dice = null;
210
+    public null | dice $dice = null;
211 211
 
212 212
     /** Optional. Message is a game, information about the game. More about games » */
213
-    public null|game $game = null;
213
+    public null | game $game = null;
214 214
 
215 215
     /** Optional. Message is a native poll, information about the poll */
216
-    public null|poll $poll = null;
216
+    public null | poll $poll = null;
217 217
 
218 218
     /**
219 219
      * Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set,
220 220
      * the location field will also be set
221 221
      */
222
-    public null|venue $venue = null;
222
+    public null | venue $venue = null;
223 223
 
224 224
     /** Optional. Message is a shared location, information about the location */
225
-    public null|location $location = null;
225
+    public null | location $location = null;
226 226
 
227 227
     /**
228 228
      * Optional. New members that were added to the group or supergroup and information about them (the bot itself
229 229
      * may be one of these members)
230 230
      * @var user[]
231 231
      */
232
-    public null|array $new_chat_members = null;
232
+    public null | array $new_chat_members = null;
233 233
 
234 234
     /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */
235
-    public null|user $left_chat_member = null;
235
+    public null | user $left_chat_member = null;
236 236
 
237 237
     /** Optional. A chat title was changed to this value */
238
-    public null|string $new_chat_title = null;
238
+    public null | string $new_chat_title = null;
239 239
 
240 240
     /**
241 241
      * Optional. A chat photo was change to this value
242 242
      * @var photoSize[]
243 243
      */
244
-    public null|array $new_chat_photo = null;
244
+    public null | array $new_chat_photo = null;
245 245
 
246 246
     /** Optional. Service message: the chat photo was deleted */
247
-    public null|bool $delete_chat_photo = null;
247
+    public null | bool $delete_chat_photo = null;
248 248
 
249 249
     /** Optional. Service message: the group has been created */
250
-    public null|bool $group_chat_created = null;
250
+    public null | bool $group_chat_created = null;
251 251
 
252 252
     /**
253 253
      * Optional. Service message: the supergroup has been created. This field can't be received in a message coming
254 254
      * through updates, because bot can't be a member of a supergroup when it is created. It can only be found in
255 255
      * reply_to_message if someone replies to a very first message in a directly created supergroup.
256 256
      */
257
-    public null|bool $supergroup_chat_created = null;
257
+    public null | bool $supergroup_chat_created = null;
258 258
 
259 259
     /**
260 260
      * Optional. Service message: the channel has been created. This field can't be received in a message coming
261 261
      * through updates, because bot can't be a member of a channel when it is created. It can only be found in
262 262
      * reply_to_message if someone replies to a very first message in a channel.
263 263
      */
264
-    public null|bool $channel_chat_created = null;
264
+    public null | bool $channel_chat_created = null;
265 265
 
266 266
     /** Optional. Service message: auto-delete timer settings changed in the chat */
267
-    public null|messageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null;
267
+    public null | messageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null;
268 268
 
269 269
     /**
270 270
      * Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for
273 273
      * storing this identifier.
274 274
      */
275
-    public null|int $migrate_to_chat_id = null;
275
+    public null | int $migrate_to_chat_id = null;
276 276
 
277 277
     /**
278 278
      * Optional. The supergroup has been migrated from a group with the specified identifier. This number may have
@@ -280,70 +280,70 @@  discard block
 block discarded – undo
280 280
      * interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float
281 281
      * type are safe for storing this identifier.
282 282
      */
283
-    public null|int $migrate_from_chat_id = null;
283
+    public null | int $migrate_from_chat_id = null;
284 284
 
285 285
     /**
286 286
      * Optional. Specified message was pinned. Note that the Message object in this field will not contain further
287 287
      * reply_to_message fields even if it is itself a reply.
288 288
      */
289
-    public null|message $pinned_message = null;
289
+    public null | message $pinned_message = null;
290 290
 
291 291
     /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */
292
-    public null|invoice $invoice = null;
292
+    public null | invoice $invoice = null;
293 293
 
294 294
     /**
295 295
      * Optional. Message is a service message about a successful payment, information about the payment. More about
296 296
      * payments »
297 297
      */
298
-    public null|successfulPayment $successful_payment = null;
298
+    public null | successfulPayment $successful_payment = null;
299 299
 
300 300
     /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */
301
-    public null|string $connected_website = null;
301
+    public null | string $connected_website = null;
302 302
 
303 303
     /** Optional. Telegram Passport data */
304
-    public null|passportData $passport_data = null;
304
+    public null | passportData $passport_data = null;
305 305
 
306 306
     /**
307 307
      * Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live
308 308
      * Location.
309 309
      */
310
-    public null|proximityAlertTriggered $proximity_alert_triggered = null;
310
+    public null | proximityAlertTriggered $proximity_alert_triggered = null;
311 311
 
312 312
     /** Optional. Service message: forum topic created */
313
-    public null|forumTopicCreated $forum_topic_created = null;
313
+    public null | forumTopicCreated $forum_topic_created = null;
314 314
 
315 315
     /** Optional. Service message: forum topic closed */
316
-    public null|forumTopicClosed $forum_topic_closed = null;
316
+    public null | forumTopicClosed $forum_topic_closed = null;
317 317
 
318 318
     /** Optional. Service message: forum topic reopened */
319
-    public null|forumTopicReopened $forum_topic_reopened = null;
319
+    public null | forumTopicReopened $forum_topic_reopened = null;
320 320
 
321 321
     /** Optional. Service message: video chat scheduled */
322
-    public null|videoChatScheduled $video_chat_scheduled = null;
322
+    public null | videoChatScheduled $video_chat_scheduled = null;
323 323
 
324 324
     /** Optional. Service message: video chat started */
325
-    public null|videoChatStarted $video_chat_started = null;
325
+    public null | videoChatStarted $video_chat_started = null;
326 326
 
327 327
     /** Optional. Service message: video chat ended */
328
-    public null|videoChatEnded $video_chat_ended = null;
328
+    public null | videoChatEnded $video_chat_ended = null;
329 329
 
330 330
     /** Optional. Service message: new participants invited to a video chat */
331
-    public null|videoChatParticipantsInvited $video_chat_participants_invited = null;
331
+    public null | videoChatParticipantsInvited $video_chat_participants_invited = null;
332 332
 
333 333
     /** Optional. Service message: data sent by a Web App */
334
-    public null|webAppData $web_app_data = null;
334
+    public null | webAppData $web_app_data = null;
335 335
 
336 336
     /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
337
-    public null|inlineKeyboardMarkup $reply_markup = null;
337
+    public null | inlineKeyboardMarkup $reply_markup = null;
338 338
 
339 339
 
340
-    public function __construct(stdClass|null $object = null) {
340
+    public function __construct(stdClass | null $object = null) {
341 341
         if ($object != null) {
342 342
             parent::__construct($object, self::subs);
343 343
         }
344 344
     }
345 345
 
346
-    public function delete (): responseError|bool {
347
-        return telegram::deleteMessage($this->chat->id,$this->id);
346
+    public function delete(): responseError | bool {
347
+        return telegram::deleteMessage($this->chat->id, $this->id);
348 348
     }
349 349
 }
Please login to merge, or discard this patch.