@@ -65,8 +65,8 @@ |
||
| 65 | 65 | public static function escapeMarkdown(string $string): string |
| 66 | 66 | { |
| 67 | 67 | return str_replace( |
| 68 | - ['[', '`', '*', '_',], |
|
| 69 | - ['\[', '\`', '\*', '\_',], |
|
| 68 | + ['[', '`', '*', '_', ], |
|
| 69 | + ['\[', '\`', '\*', '\_', ], |
|
| 70 | 70 | $string |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | // Get the correct logger instance. |
| 117 | 117 | $logger = null; |
| 118 | 118 | self::initialize(); |
| 119 | - if (in_array($name, ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug',], true)) { |
|
| 119 | + if (in_array($name, ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', ], true)) { |
|
| 120 | 120 | $logger = self::$logger; |
| 121 | 121 | } elseif ($name === 'update') { |
| 122 | 122 | $logger = self::$update_logger; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $data['raw_data'] = $data; |
| 43 | 43 | $this->response = $data; |
| 44 | 44 | |
| 45 | - $is_ok = (bool)($data['ok'] ?? false); |
|
| 45 | + $is_ok = (bool) ($data['ok'] ?? false); |
|
| 46 | 46 | $result = $data['result'] ?? null; |
| 47 | 47 | |
| 48 | 48 | if ($is_ok) { |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | if ($these_photos = $this->getProperty('photos')) { |
| 39 | 39 | foreach ($these_photos as $photos) { |
| 40 | - $all_photos[] = array_map(function ($photo) { |
|
| 40 | + $all_photos[] = array_map(function($photo) { |
|
| 41 | 41 | return new PhotoSize($photo); |
| 42 | 42 | }, $photos); |
| 43 | 43 | } |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | CrashPad::setAdminChatId($admin_id); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - set_exception_handler(function ($exception) { |
|
| 130 | + set_exception_handler(function($exception) { |
|
| 131 | 131 | if (!defined('DEBUG_MODE') && !DEBUG_MODE) { |
| 132 | 132 | throw $exception; |
| 133 | 133 | } else { |
@@ -102,7 +102,9 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function getEnvToken(string $file): string|null |
| 104 | 104 | { |
| 105 | - if (!file_exists($file)) return null; |
|
| 105 | + if (!file_exists($file)) { |
|
| 106 | + return null; |
|
| 107 | + } |
|
| 106 | 108 | return $_ENV['TELEGRAM_BOT_TOKEN'] ?? null; |
| 107 | 109 | } |
| 108 | 110 | |
@@ -191,7 +193,9 @@ discard block |
||
| 191 | 193 | public function fetchWith(UpdateHandler $webhook_handler, Update|null $update = null): void |
| 192 | 194 | { |
| 193 | 195 | if (is_subclass_of($webhook_handler, UpdateHandler::class)) { |
| 194 | - if ($update === null) $update = self::getUpdate(); |
|
| 196 | + if ($update === null) { |
|
| 197 | + $update = self::getUpdate(); |
|
| 198 | + } |
|
| 195 | 199 | $webhook_handler->resolve($update); |
| 196 | 200 | } |
| 197 | 201 | } |
@@ -204,7 +208,9 @@ discard block |
||
| 204 | 208 | public static function getUpdate(): Update|false |
| 205 | 209 | { |
| 206 | 210 | $input = self::getInput(); |
| 207 | - if (empty($input)) return false; |
|
| 211 | + if (empty($input)) { |
|
| 212 | + return false; |
|
| 213 | + } |
|
| 208 | 214 | return Telegram::processUpdate($input, self::getApiToken()); |
| 209 | 215 | } |
| 210 | 216 | |
@@ -134,7 +134,9 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $plugin['class']->__execute($this, $update); |
| 137 | - if ($this->active_spreader === false) break; |
|
| 137 | + if ($this->active_spreader === false) { |
|
| 138 | + break; |
|
| 139 | + } |
|
| 138 | 140 | } |
| 139 | 141 | |
| 140 | 142 | $this->active_spreader = false; |
@@ -154,10 +156,15 @@ discard block |
||
| 154 | 156 | throw new \RuntimeException('The method __process does not exist'); |
| 155 | 157 | } |
| 156 | 158 | |
| 157 | - if (is_array($config)) $this->updateConfiguration($config); |
|
| 159 | + if (is_array($config)) { |
|
| 160 | + $this->updateConfiguration($config); |
|
| 161 | + } |
|
| 158 | 162 | |
| 159 | - if (!empty($update)) $this->update = $update; |
|
| 160 | - else $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
| 163 | + if (!empty($update)) { |
|
| 164 | + $this->update = $update; |
|
| 165 | + } else { |
|
| 166 | + $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
| 167 | + } |
|
| 161 | 168 | |
| 162 | 169 | if (empty($this->update)) { |
| 163 | 170 | TelegramLog::error( |