@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace unreal4u\TelegramAPI; |
6 | 6 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | $promise = $this->httpClient->postAsync($uri, $formData); |
98 | 98 | $promise->then( |
99 | - function (ResponseInterface $response) use ($deferred) { |
|
99 | + function(ResponseInterface $response) use ($deferred) { |
|
100 | 100 | $deferred->resolve(new TelegramRawData((string)$response->getBody())); |
101 | 101 | }, |
102 | - function (RequestException $exception) use ($deferred) { |
|
102 | + function(RequestException $exception) use ($deferred) { |
|
103 | 103 | if (!empty($exception->getResponse()->getBody())) { |
104 | 104 | $deferred->resolve(new TelegramRawData((string)$exception->getResponse() |
105 | 105 | ->getBody(), $exception)); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | |
125 | 125 | $promise = $this->httpClient->getAsync($uri); |
126 | 126 | $promise->then( |
127 | - function (ResponseInterface $response) use ($deferred) { |
|
127 | + function(ResponseInterface $response) use ($deferred) { |
|
128 | 128 | $deferred->resolve(new TelegramRawData((string)$response->getBody())); |
129 | 129 | }, |
130 | - function (RequestException $exception) use ($deferred) { |
|
130 | + function(RequestException $exception) use ($deferred) { |
|
131 | 131 | if (!empty($exception->getResponse()->getBody())) { |
132 | 132 | $deferred->resolve(new TelegramRawData((string)$exception->getResponse() |
133 | 133 | ->getBody(), $exception)); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | break; |
67 | 67 | default: |
68 | 68 | $this->logger->critical(sprintf( |
69 | - 'Invalid form-type detected, if you incur in such a situation, this is most likely a product to ' . |
|
69 | + 'Invalid form-type detected, if you incur in such a situation, this is most likely a product to '. |
|
70 | 70 | 'a bug. Please copy entire line and report at %s', |
71 | 71 | 'https://github.com/unreal4u/telegram-api/issues' |
72 | 72 | ), [ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace unreal4u\TelegramAPI; |
6 | 6 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function downloadFile(File $file): TelegramDocument |
130 | 130 | { |
131 | 131 | $this->logger->debug('Downloading file from Telegram, creating URL'); |
132 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
132 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
133 | 133 | $this->logger->debug('About to perform request to begin downloading file'); |
134 | 134 | return new TelegramDocument($this->requestHandler->get($url)); |
135 | 135 | } |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | public function downloadFileAsync(File $file): PromiseInterface |
143 | 143 | { |
144 | 144 | $this->logger->debug('Downloading file async from Telegram, creating URL'); |
145 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
145 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
146 | 146 | $this->logger->debug('About to perform request to begin downloading file'); |
147 | 147 | |
148 | 148 | $deferred = new Deferred(); |
149 | 149 | |
150 | 150 | return $this->requestHandler->getAsync($url)->then( |
151 | - function (ResponseInterface $response) use ($deferred) { |
|
151 | + function(ResponseInterface $response) use ($deferred) { |
|
152 | 152 | $deferred->resolve(new TelegramDocument($response)); |
153 | 153 | }, |
154 | - function (\Exception $exception) use ($deferred) { |
|
154 | + function(\Exception $exception) use ($deferred) { |
|
155 | 155 | if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) { |
156 | 156 | $deferred->resolve(new TelegramDocument($exception->getResponse())); |
157 | 157 | } else { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | final private function constructApiUrl(): TgLog |
169 | 169 | { |
170 | - $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/'; |
|
170 | + $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/'; |
|
171 | 171 | $this->logger->debug('Built up the API URL'); |
172 | 172 | return $this; |
173 | 173 | } |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | |
212 | 212 | $promise = $this->requestHandler->postAsync($this->composeApiMethodUrl($method), $formData); |
213 | 213 | $promise->then( |
214 | - function (ResponseInterface $response) use ($deferred) { |
|
214 | + function(ResponseInterface $response) use ($deferred) { |
|
215 | 215 | $deferred->resolve(new TelegramRawData((string)$response->getBody())); |
216 | 216 | }, |
217 | - function (\Exception $exception) use ($deferred) { |
|
217 | + function(\Exception $exception) use ($deferred) { |
|
218 | 218 | if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) { |
219 | 219 | $deferred->resolve(new TelegramRawData((string)$exception->getResponse()->getBody(), $exception)); |
220 | 220 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1); |
255 | 255 | $this->logger->info('About to perform API request', ['method' => $this->methodName]); |
256 | 256 | |
257 | - return $this->apiUrl . $this->methodName; |
|
257 | + return $this->apiUrl.$this->methodName; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |