@@ -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 | } |
@@ -104,7 +104,7 @@ |
||
104 | 104 | Telegram::setAdminId($admin_id); |
105 | 105 | } |
106 | 106 | |
107 | - set_exception_handler(function (\Throwable $throwable) { |
|
107 | + set_exception_handler(function(\Throwable $throwable) { |
|
108 | 108 | if (!defined('DEBUG_MODE') && !DEBUG_MODE) { |
109 | 109 | throw new \RuntimeException( |
110 | 110 | $throwable->getMessage(), |
@@ -104,7 +104,9 @@ discard block |
||
104 | 104 | public function fetchWith(UpdateHandler $update_handler, Update|null $update = null): void |
105 | 105 | { |
106 | 106 | if (is_subclass_of($update_handler, UpdateHandler::class)) { |
107 | - if ($update === null) $update = self::getUpdate(); |
|
107 | + if ($update === null) { |
|
108 | + $update = self::getUpdate(); |
|
109 | + } |
|
108 | 110 | $update_handler->resolve($update); |
109 | 111 | } |
110 | 112 | } |
@@ -117,7 +119,9 @@ discard block |
||
117 | 119 | public static function getUpdate(): Update|false |
118 | 120 | { |
119 | 121 | $input = self::getInput(); |
120 | - if (empty($input)) return false; |
|
122 | + if (empty($input)) { |
|
123 | + return false; |
|
124 | + } |
|
121 | 125 | return Telegram::processUpdate($input, self::getApiToken()); |
122 | 126 | } |
123 | 127 |
@@ -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 |
@@ -115,10 +115,15 @@ discard block |
||
115 | 115 | throw new \RuntimeException('The method __process does not exist'); |
116 | 116 | } |
117 | 117 | |
118 | - if (is_array($config)) $this->updateConfiguration($config); |
|
118 | + if (is_array($config)) { |
|
119 | + $this->updateConfiguration($config); |
|
120 | + } |
|
119 | 121 | |
120 | - if (!empty($update)) $this->update = $update; |
|
121 | - else $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
122 | + if (!empty($update)) { |
|
123 | + $this->update = $update; |
|
124 | + } else { |
|
125 | + $this->update = Telegram::getUpdate() !== false ? Telegram::getUpdate() : null; |
|
126 | + } |
|
122 | 127 | |
123 | 128 | if (empty($this->update)) { |
124 | 129 | TelegramLog::error( |
@@ -190,7 +195,9 @@ discard block |
||
190 | 195 | } |
191 | 196 | |
192 | 197 | $plugin['class']->__execute($this, $update); |
193 | - if ($this->active_spreader === false) break; |
|
198 | + if ($this->active_spreader === false) { |
|
199 | + break; |
|
200 | + } |
|
194 | 201 | } |
195 | 202 | |
196 | 203 | $this->active_spreader = false; |