@@ -5,7 +5,7 @@ |
||
5 | 5 | use mysqli; |
6 | 6 | |
7 | 7 | class db { |
8 | - public static function init (array|mysqli $db) { |
|
8 | + public static function init(array | mysqli $db) { |
|
9 | 9 | |
10 | 10 | } |
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @method static getGameHigh (int|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 $return_array = 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. On success, returns an Array of GameHighScore objects. |
215 | 215 | */ |
216 | 216 | class telegram { |
217 | - public function __call (string $name, array $arguments) { |
|
217 | + public function __call(string $name, array $arguments) { |
|
218 | 218 | if (!isset($arguments[1]) && is_array($arguments[0])) { |
219 | 219 | request::$name(...$arguments[0]); |
220 | 220 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - public static function __callStatic (string $name, array $arguments) { |
|
226 | + public static function __callStatic(string $name, array $arguments) { |
|
227 | 227 | if (!isset($arguments[1]) && is_array($arguments[0])) { |
228 | 228 | request::$name(...$arguments[0]); |
229 | 229 | } |
@@ -225,18 +225,18 @@ discard block |
||
225 | 225 | ]; |
226 | 226 | |
227 | 227 | |
228 | - public static function __callStatic (string $name, array $arguments) { |
|
228 | + public static function __callStatic(string $name, array $arguments) { |
|
229 | 229 | if ($action = self::methodAction($name)) { |
230 | - self::keysName($action,$arguments); |
|
231 | - self::readyFile($action,$arguments); |
|
230 | + self::keysName($action, $arguments); |
|
231 | + self::readyFile($action, $arguments); |
|
232 | 232 | print_r($arguments); |
233 | 233 | } |
234 | 234 | else { |
235 | - logger::write("$name method is not supported",'error'); |
|
235 | + logger::write("$name method is not supported", 'error'); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | - private static function keysName (string $name, array &$arguments) { |
|
239 | + private static function keysName(string $name, array &$arguments) { |
|
240 | 240 | foreach ($arguments as $key => $argument) { |
241 | 241 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
242 | 242 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - private static function methodAction(string $name): string|false { |
|
248 | + private static function methodAction(string $name): string | false { |
|
249 | 249 | return self::METHODS_ACTION[strtolower($name)] ?? false; |
250 | 250 | } |
251 | 251 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - private static function methodFile(string $name): array|false { |
|
269 | + private static function methodFile(string $name): array | false { |
|
270 | 270 | return self::METHODS_WITH_FILE[$name] ?? false; |
271 | 271 | } |
272 | 272 | } |
273 | 273 | \ No newline at end of file |
@@ -11,16 +11,16 @@ |
||
11 | 11 | return touch("$name.lock"); |
12 | 12 | } |
13 | 13 | |
14 | - public static function save(string $name, string $data): bool|int { |
|
14 | + public static function save(string $name, string $data): bool | int { |
|
15 | 15 | return file_put_contents("$name.lock", $data); |
16 | 16 | |
17 | 17 | } |
18 | 18 | |
19 | - public static function read(string $name): bool|string { |
|
19 | + public static function read(string $name): bool | string { |
|
20 | 20 | return file_get_contents("$name.lock"); |
21 | 21 | } |
22 | 22 | |
23 | - public static function mtime(string $name): bool|int { |
|
23 | + public static function mtime(string $name): bool | int { |
|
24 | 24 | return filemtime("$name.lock"); |
25 | 25 | } |
26 | 26 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if (lock::exist('BPT-MULTI-EXEC')) { |
14 | 14 | self::setUpdate(exec::init()); |
15 | 15 | } |
16 | - elseif(lock::exist('BPT-MULTI-CURL')) { |
|
16 | + elseif (lock::exist('BPT-MULTI-CURL')) { |
|
17 | 17 | self::setUpdate(curl::init()); |
18 | 18 | } |
19 | 19 | else { |
@@ -9,19 +9,19 @@ discard block |
||
9 | 9 | use stdClass; |
10 | 10 | |
11 | 11 | class getUpdates extends receiver { |
12 | - public static function init () { |
|
12 | + public static function init() { |
|
13 | 13 | $last_update_id = self::loadData(); |
14 | - while(true) { |
|
14 | + while (true) { |
|
15 | 15 | if (!lock::exist('getUpdate')) { |
16 | - $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates)->result; |
|
16 | + $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates)->result; |
|
17 | 17 | self::handleUpdates($updates); |
18 | - lock::save('getUpdate',BPT::$update->update_id+1); |
|
19 | - $last_update_id = BPT::$update->update_id+1; |
|
18 | + lock::save('getUpdate', BPT::$update->update_id + 1); |
|
19 | + $last_update_id = BPT::$update->update_id + 1; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | - private static function loadData(): bool|int|string { |
|
24 | + private static function loadData(): bool | int | string { |
|
25 | 25 | if (lock::exist('getUpdate')) { |
26 | 26 | $last_update_id = lock::read('getUpdate'); |
27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | self::deleteOldLocks(); |
30 | 30 | telegram::deleteWebhook(); |
31 | 31 | $last_update_id = 0; |
32 | - lock::save('getUpdate',0); |
|
32 | + lock::save('getUpdate', 0); |
|
33 | 33 | } |
34 | 34 | return $last_update_id; |
35 | 35 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | private static $handler; |
11 | 11 | |
12 | 12 | |
13 | - public static function init (int $log_size = 10) { |
|
13 | + public static function init(int $log_size = 10) { |
|
14 | 14 | self::$log_size = $log_size; |
15 | 15 | if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) { |
16 | 16 | $mode = 'a'; |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | self::$handler = fopen('BPT.log', $mode); |
25 | 25 | |
26 | 26 | if ($write) { |
27 | - 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"); |
|
27 | + 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"); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | public static function write(string $data, string $type = loggerTypes::NONE) { |
32 | 32 | if (!is_null(self::$handler)) { |
33 | - $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" ); |
|
33 | + $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n"); |
|
34 | 34 | fwrite(self::$handler, $text); |
35 | 35 | } |
36 | 36 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
27 | 27 | } |
28 | 28 | } |
29 | - else{ |
|
29 | + else { |
|
30 | 30 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
34 | - else{ |
|
34 | + else { |
|
35 | 35 | $this->$key = $value; |
36 | 36 | if (ucfirst($key) === basename(get_class($this)).'_id') { |
37 | 37 | $this->{'id'} = $value; |
@@ -139,13 +139,13 @@ |
||
139 | 139 | public string $text; |
140 | 140 | |
141 | 141 | /** Optional. If user message was a commend , this parameter will be the commend */ |
142 | - public string|null $commend; |
|
142 | + public string | null $commend; |
|
143 | 143 | |
144 | 144 | /** Optional. If user message was a commend , this parameter will be the commend username(if exist) */ |
145 | - public string|null $commend_username; |
|
145 | + public string | null $commend_username; |
|
146 | 146 | |
147 | 147 | /** Optional. If user message was a commend , this parameter will be the commend payload(if exist) */ |
148 | - public string|null $commend_payload; |
|
148 | + public string | null $commend_payload; |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text |