@@ -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 | } |
@@ -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 | } |
@@ -122,7 +122,9 @@ discard block |
||
| 122 | 122 | throw new \RuntimeException('The method __process does not exist'); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if (is_array($config)) $this->updateConfiguration($config); |
|
| 125 | + if (is_array($config)) { |
|
| 126 | + $this->updateConfiguration($config); |
|
| 127 | + } |
|
| 126 | 128 | |
| 127 | 129 | putenv('TG_CURRENT_UPDATE=' . $this->update->getRawData(false)); |
| 128 | 130 | |
@@ -187,7 +189,9 @@ discard block |
||
| 187 | 189 | } |
| 188 | 190 | |
| 189 | 191 | $plugin['class']->__execute($this, $update); |
| 190 | - if ($this->active_spreader === false) break; |
|
| 192 | + if ($this->active_spreader === false) { |
|
| 193 | + break; |
|
| 194 | + } |
|
| 191 | 195 | } |
| 192 | 196 | |
| 193 | 197 | $this->active_spreader = false; |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | protected function getEnvToken(string $file): string|null |
| 52 | 52 | { |
| 53 | - if (!file_exists($file)) return null; |
|
| 53 | + if (!file_exists($file)) { |
|
| 54 | + return null; |
|
| 55 | + } |
|
| 54 | 56 | return $_ENV['TELEGRAM_BOT_TOKEN'] ?? null; |
| 55 | 57 | } |
| 56 | 58 | |
@@ -107,7 +107,9 @@ discard block |
||
| 107 | 107 | public function fetchWith(UpdateHandler $update_handler, Update|null $update = null): void |
| 108 | 108 | { |
| 109 | 109 | if (is_subclass_of($update_handler, UpdateHandler::class)) { |
| 110 | - if ($update === null) $update = self::getUpdate(); |
|
| 110 | + if ($update === null) { |
|
| 111 | + $update = self::getUpdate(); |
|
| 112 | + } |
|
| 111 | 113 | $update_handler->resolve($update); |
| 112 | 114 | } |
| 113 | 115 | } |
@@ -120,7 +122,9 @@ discard block |
||
| 120 | 122 | public static function getUpdate(): Update|null |
| 121 | 123 | { |
| 122 | 124 | $input = self::getInput(); |
| 123 | - if (empty($input)) return null; |
|
| 125 | + if (empty($input)) { |
|
| 126 | + return null; |
|
| 127 | + } |
|
| 124 | 128 | return Telegram::processUpdate($input, self::getApiToken()); |
| 125 | 129 | } |
| 126 | 130 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public static function enableCrashHandler(): void |
| 26 | 26 | { |
| 27 | - $handler = function (Throwable $throwable) { |
|
| 27 | + $handler = function(Throwable $throwable) { |
|
| 28 | 28 | if (Telegram::getAdminId() !== -1) { |
| 29 | 29 | $input = getenv('TG_CURRENT_UPDATE') ?? Telegram::getInput(); |
| 30 | 30 | CrashPad::sendCrash(Telegram::getAdminId(), $throwable, $input); |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | { |
| 116 | 116 | // Get the correct logger instance. |
| 117 | 117 | $logger = null; |
| 118 | - if (in_array($name, ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug',], true)) { |
|
| 118 | + if (in_array($name, ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', ], true)) { |
|
| 119 | 119 | $logger = self::$logger; |
| 120 | 120 | } elseif ($name === 'update') { |
| 121 | 121 | $logger = self::$update_logger; |