@@ -85,7 +85,7 @@ |
||
| 85 | 85 | defined('TG_ADMIN_ID') or define('TG_ADMIN_ID', $admin_id); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - set_exception_handler(function ($exception) { |
|
| 88 | + set_exception_handler(function($exception) { |
|
| 89 | 89 | |
| 90 | 90 | if (defined('DEBUG_MODE') && DEBUG_MODE) { |
| 91 | 91 | |
@@ -235,7 +235,9 @@ discard block |
||
| 235 | 235 | public function fetchWith(UpdateHandler $webhook_handler, ?Update $update = null): void |
| 236 | 236 | { |
| 237 | 237 | if (is_subclass_of($webhook_handler, UpdateHandler::class)) { |
| 238 | - if ($update === null) $update = self::getUpdate(); |
|
| 238 | + if ($update === null) { |
|
| 239 | + $update = self::getUpdate(); |
|
| 240 | + } |
|
| 239 | 241 | $webhook_handler->resolve($update); |
| 240 | 242 | } |
| 241 | 243 | } |
@@ -248,7 +250,9 @@ discard block |
||
| 248 | 250 | public static function getUpdate(): Update|false |
| 249 | 251 | { |
| 250 | 252 | $input = self::getInput(); |
| 251 | - if (empty($input)) return false; |
|
| 253 | + if (empty($input)) { |
|
| 254 | + return false; |
|
| 255 | + } |
|
| 252 | 256 | return Telegram::processUpdate($input, self::getApiKey()); |
| 253 | 257 | } |
| 254 | 258 | |
@@ -375,7 +379,9 @@ discard block |
||
| 375 | 379 | */ |
| 376 | 380 | protected function getTokenFromEnvFile(string $file): ?string |
| 377 | 381 | { |
| 378 | - if (!file_exists($file)) return null; |
|
| 382 | + if (!file_exists($file)) { |
|
| 383 | + return null; |
|
| 384 | + } |
|
| 379 | 385 | return DotEnv::load($file)::get('TELEGRAM_BOT_TOKEN'); |
| 380 | 386 | } |
| 381 | 387 | |
@@ -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 | } |
@@ -137,7 +137,9 @@ discard block |
||
| 137 | 137 | foreach ($plugins as $plugin) { |
| 138 | 138 | /** @var Plugin $plugin */ |
| 139 | 139 | (new $plugin())->__execute($this, $update); |
| 140 | - if ($this->isActive === false) break; |
|
| 140 | + if ($this->isActive === false) { |
|
| 141 | + break; |
|
| 142 | + } |
|
| 141 | 143 | } |
| 142 | 144 | |
| 143 | 145 | $this->isActive = false; |
@@ -168,10 +170,15 @@ discard block |
||
| 168 | 170 | throw new \RuntimeException('The method __process does not exist'); |
| 169 | 171 | } |
| 170 | 172 | |
| 171 | - if (is_array($config)) $this->updateConfiguration($config); |
|
| 173 | + if (is_array($config)) { |
|
| 174 | + $this->updateConfiguration($config); |
|
| 175 | + } |
|
| 172 | 176 | |
| 173 | - if (!empty($update)) $this->update = $update; |
|
| 174 | - else $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
| 177 | + if (!empty($update)) { |
|
| 178 | + $this->update = $update; |
|
| 179 | + } else { |
|
| 180 | + $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
| 181 | + } |
|
| 175 | 182 | |
| 176 | 183 | if (empty($this->update)) { |
| 177 | 184 | TelegramLog::error( |
@@ -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; |
@@ -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 | } |