@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function downloadFile(File $file): TelegramDocument |
| 135 | 135 | { |
| 136 | 136 | $this->logger->debug('Downloading file from Telegram, creating URL'); |
| 137 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
| 137 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
| 138 | 138 | $this->logger->debug('About to perform request to begin downloading file'); |
| 139 | 139 | return new TelegramDocument($this->httpClient->get($url)); |
| 140 | 140 | } |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | public function downloadFileAsync(File $file): PromiseInterface |
| 148 | 148 | { |
| 149 | 149 | $this->logger->debug('Downloading file async from Telegram, creating URL'); |
| 150 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
| 150 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
| 151 | 151 | $this->logger->debug('About to perform request to begin downloading file'); |
| 152 | 152 | |
| 153 | 153 | $deferred = new Promise(); |
| 154 | 154 | |
| 155 | - return $this->httpClient->getAsync($url)->then(function (ResponseInterface $response) use ($deferred) |
|
| 155 | + return $this->httpClient->getAsync($url)->then(function(ResponseInterface $response) use ($deferred) |
|
| 156 | 156 | { |
| 157 | 157 | $deferred->resolve(new TelegramDocument($response)); |
| 158 | 158 | }, |
| 159 | - function (RequestException $exception) use ($deferred) |
|
| 159 | + function(RequestException $exception) use ($deferred) |
|
| 160 | 160 | { |
| 161 | 161 | if (!empty($exception->getResponse()->getBody())) |
| 162 | 162 | $deferred->resolve(new TelegramDocument($exception->getResponse())); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | final private function constructApiUrl(): TgLog |
| 173 | 173 | { |
| 174 | - $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/'; |
|
| 174 | + $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/'; |
|
| 175 | 175 | $this->logger->debug('Built up the API URL'); |
| 176 | 176 | return $this; |
| 177 | 177 | } |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | $deferred = new Promise(); |
| 215 | 215 | |
| 216 | 216 | $promise = $this->httpClient->postAsync($this->composeApiMethodUrl($method), $formData); |
| 217 | - $promise->then(function (ResponseInterface $response) use ($deferred) |
|
| 217 | + $promise->then(function(ResponseInterface $response) use ($deferred) |
|
| 218 | 218 | { |
| 219 | - $deferred->resolve(new TelegramRawData((string) $response->getBody())); |
|
| 219 | + $deferred->resolve(new TelegramRawData((string)$response->getBody())); |
|
| 220 | 220 | }, |
| 221 | - function (RequestException $exception) use ($deferred) |
|
| 221 | + function(RequestException $exception) use ($deferred) |
|
| 222 | 222 | { |
| 223 | 223 | if (!empty($exception->getResponse()->getBody())) |
| 224 | - $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception)); |
|
| 224 | + $deferred->resolve(new TelegramRawData((string)$exception->getResponse()->getBody(), $exception)); |
|
| 225 | 225 | else |
| 226 | 226 | $deferred->reject($exception); |
| 227 | 227 | }); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1); |
| 330 | 330 | $this->logger->info('About to perform API request', ['method' => $this->methodName]); |
| 331 | 331 | |
| 332 | - return $this->apiUrl . $this->methodName; |
|
| 332 | + return $this->apiUrl.$this->methodName; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -158,10 +158,11 @@ discard block |
||
| 158 | 158 | }, |
| 159 | 159 | function (RequestException $exception) use ($deferred) |
| 160 | 160 | { |
| 161 | - if (!empty($exception->getResponse()->getBody())) |
|
| 162 | - $deferred->resolve(new TelegramDocument($exception->getResponse())); |
|
| 163 | - else |
|
| 164 | - $deferred->reject($exception); |
|
| 161 | + if (!empty($exception->getResponse()->getBody())) { |
|
| 162 | + $deferred->resolve(new TelegramDocument($exception->getResponse())); |
|
| 163 | + } else { |
|
| 164 | + $deferred->reject($exception); |
|
| 165 | + } |
|
| 165 | 166 | }); |
| 166 | 167 | } |
| 167 | 168 | |
@@ -220,10 +221,11 @@ discard block |
||
| 220 | 221 | }, |
| 221 | 222 | function (RequestException $exception) use ($deferred) |
| 222 | 223 | { |
| 223 | - if (!empty($exception->getResponse()->getBody())) |
|
| 224 | - $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception)); |
|
| 225 | - else |
|
| 226 | - $deferred->reject($exception); |
|
| 224 | + if (!empty($exception->getResponse()->getBody())) { |
|
| 225 | + $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception)); |
|
| 226 | + } else { |
|
| 227 | + $deferred->reject($exception); |
|
| 228 | + } |
|
| 227 | 229 | }); |
| 228 | 230 | |
| 229 | 231 | return $deferred; |