@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * @method gameHighScore[]|responseError getGameHighScores (int|null|array $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. |
241 | 241 | * @method gameHighScore[]|responseError getGameHigh (int|null|array $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. |
242 | 242 | */ |
243 | -class BPT extends telegram{ |
|
243 | +class BPT extends telegram { |
|
244 | 244 | public static update $update; |
245 | 245 | |
246 | 246 | public static BPT $handler; |
247 | 247 | |
248 | 248 | |
249 | - public function __construct (array|stdClass $settings) { |
|
249 | + public function __construct(array | stdClass $settings) { |
|
250 | 250 | static::$handler = &$this; |
251 | 251 | settings::init($settings); |
252 | 252 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | settings::done(); |
256 | 256 | } |
257 | 257 | |
258 | - public static function exit (string|null $message = null) { |
|
258 | + public static function exit (string | null $message = null) { |
|
259 | 259 | die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>"); |
260 | 260 | } |
261 | 261 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public static int $log_size = 10; |
25 | 25 | |
26 | - public static string|CURLFile|null $certificate = null; |
|
26 | + public static string | CURLFile | null $certificate = null; |
|
27 | 27 | |
28 | 28 | public static bool $handler = true; |
29 | 29 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | |
54 | 54 | public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query']; |
55 | 55 | |
56 | - public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
56 | + public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
57 | 57 | |
58 | 58 | |
59 | - public static function init (array|stdClass $settings) { |
|
59 | + public static function init(array | stdClass $settings) { |
|
60 | 60 | $settings = (array) $settings; |
61 | 61 | |
62 | 62 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | foreach ($settings as $setting => $value) { |
67 | - try{ |
|
67 | + try { |
|
68 | 68 | self::$$setting = $value; |
69 | 69 | } |
70 | - catch (TypeError){ |
|
71 | - logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
|
70 | + catch (TypeError) { |
|
71 | + logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING); |
|
72 | 72 | } |
73 | - catch (Error){ |
|
74 | - logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
|
73 | + catch (Error) { |
|
74 | + logger::write("$setting setting is not one of library settings", loggerTypes::WARNING); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
84 | 84 | } |
85 | 85 | else { |
86 | - logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
|
86 | + logger::write('token format is not right, check it and try again', loggerTypes::ERROR); |
|
87 | 87 | throw new bptException('TOKEN_NOT_TRUE'); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | else { |
91 | - logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
|
91 | + logger::write('You must specify token parameter in settings', loggerTypes::ERROR); |
|
92 | 92 | throw new bptException('TOKEN_NOT_FOUND'); |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | 96 | public static function done() { |
97 | 97 | if (self::$logger) { |
98 | - $estimated = round((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'])*1000,2); |
|
98 | + $estimated = round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2); |
|
99 | 99 | $status_message = match (true) { |
100 | 100 | $estimated < 100 => 'Excellent', |
101 | 101 | $estimated < 500 => 'Very good', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if (self::$secure_folder) { |
128 | 128 | $address = explode('/', $_SERVER['REQUEST_URI']); |
129 | 129 | unset($address[count($address) - 1]); |
130 | - $address = implode('/', $address) . '/BPT.php'; |
|
130 | + $address = implode('/', $address).'/BPT.php'; |
|
131 | 131 | $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n Order Allow,Deny\n Allow from all\n</Files>"; |
132 | 132 | if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) { |
133 | 133 | file_put_contents('.htaccess', $text); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | getUpdates::init(); |
147 | 147 | } |
148 | 148 | else { |
149 | - logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR); |
|
149 | + logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR); |
|
150 | 150 | throw new bptException('GETUPDATE_NEED_HANDLER'); |
151 | 151 | } |
152 | 152 | } |