Completed
Pull Request — master (#53)
by Rick
02:24
created
src/TgLog.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace unreal4u\TelegramAPI;
6 6
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     public function downloadFile(File $file): TelegramDocument
136 136
     {
137 137
         $this->logger->debug('Downloading file from Telegram, creating URL');
138
-        $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
138
+        $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
139 139
         $this->logger->debug('About to perform request to begin downloading file');
140 140
         return new TelegramDocument($this->requestHandler->get($url));
141 141
     }
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
     public function downloadFileAsync(File $file): PromiseInterface
149 149
     {
150 150
         $this->logger->debug('Downloading file async from Telegram, creating URL');
151
-        $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
151
+        $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
152 152
         $this->logger->debug('About to perform request to begin downloading file');
153 153
 
154 154
         $deferred = new Deferred();
155 155
 
156 156
         return $this->requestHandler->getAsync($url)->then(
157
-            function (ResponseInterface $response) use ($deferred) {
157
+            function(ResponseInterface $response) use ($deferred) {
158 158
                 $deferred->resolve(new TelegramDocument($response));
159 159
             },
160
-            function (\Exception $exception) use ($deferred) {
160
+            function(\Exception $exception) use ($deferred) {
161 161
                 if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) {
162 162
                     $deferred->resolve(new TelegramDocument($exception->getResponse()));
163 163
                 } else {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     final private function constructApiUrl(): TgLog
175 175
     {
176
-        $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/';
176
+        $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/';
177 177
         $this->logger->debug('Built up the API URL');
178 178
         return $this;
179 179
     }
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 
218 218
         $promise = $this->requestHandler->postAsync($this->composeApiMethodUrl($method), $formData);
219 219
         $promise->then(
220
-            function (ResponseInterface $response) use ($deferred) {
220
+            function(ResponseInterface $response) use ($deferred) {
221 221
                 $deferred->resolve(new TelegramRawData((string)$response->getBody()));
222 222
             },
223
-            function (\Exception $exception) use ($deferred) {
223
+            function(\Exception $exception) use ($deferred) {
224 224
                 if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) {
225 225
                     $deferred->resolve(new TelegramRawData((string)$exception->getResponse()->getBody(), $exception));
226 226
                 } else {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 break;
274 274
             default:
275 275
                 $this->logger->critical(sprintf(
276
-                    'Invalid form-type detected, if you incur in such a situation, this is most likely a product to ' .
276
+                    'Invalid form-type detected, if you incur in such a situation, this is most likely a product to '.
277 277
                     'a bug. Please copy entire line and report at %s',
278 278
                     'https://github.com/unreal4u/telegram-api/issues'
279 279
                 ), [
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
340 340
         $this->logger->info('About to perform API request', ['method' => $this->methodName]);
341 341
 
342
-        return $this->apiUrl . $this->methodName;
342
+        return $this->apiUrl.$this->methodName;
343 343
     }
344 344
 
345 345
     /**
Please login to merge, or discard this patch.
src/GuzzleRequestHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.