Completed
Pull Request — master (#53)
by Rick
02:13
created
src/TgLog.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
         return $this;
175 175
     }
176 176
 
177
-	/**
178
-	 * This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work
179
-	 *
180
-	 * @param TelegramMethods $method
181
-	 * @param array $formData
182
-	 *
183
-	 * @return TelegramRawData
184
-	 * @throws \Exception
185
-	 */
177
+ /**
178
+  * This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work
179
+  *
180
+  * @param TelegramMethods $method
181
+  * @param array $formData
182
+  *
183
+  * @return TelegramRawData
184
+  * @throws \Exception
185
+  */
186 186
     protected function sendRequestToTelegram(TelegramMethods $method, array $formData): TelegramRawData
187 187
     {
188 188
         $e = null;
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
         try {
191 191
             $response = $this->requestHandler->post($this->composeApiMethodUrl($method), $formData);
192 192
             $this->logger->debug('Got response back from Telegram');
193
-	        return $response;
193
+         return $response;
194 194
         } catch (\Exception $e) {
195 195
             // It can happen that we have a network problem, in such case, we can't do nothing about it, so rethrow
196 196
             if (!method_exists($e, 'getResponse') || empty($e->getResponse())) {
197 197
                 throw $e;
198 198
             }
199
-	        return new TelegramRawData((string)$e->getResponse()->getBody(), $e);
199
+         return new TelegramRawData((string)$e->getResponse()->getBody(), $e);
200 200
         }
201 201
     }
202 202
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
             case 'application/x-www-form-urlencoded':
258 258
                 $this->logger->debug('Creating x-www-form-urlencoded form (AKA fast request)');
259 259
                 $formData = [
260
-	                'headers' =>  [
261
-	                	'Content-Type' => 'application/x-www-form-urlencoded',
262
-	                ],
260
+                 'headers' =>  [
261
+                  'Content-Type' => 'application/x-www-form-urlencoded',
262
+                 ],
263 263
                     'body' => http_build_query($method->export(), '', '&'),
264 264
                 ];
265 265
                 break;
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
                     $this->formType
276 276
                 ]);
277 277
                 $formData = [
278
-                	'headers' => [
279
-	                    'Content-Type' => $this->formType
278
+                 'headers' => [
279
+                     'Content-Type' => $this->formType
280 280
                     ]
281 281
                 ];
282 282
                 break;
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     {
350 350
         $this->logger->debug('Creating multi-part form array data (complex and expensive)');
351 351
         $formData = [
352
-        	'body' => null
352
+         'body' => null
353 353
         ];
354 354
 
355 355
         $multiPartArray = [];
Please login to merge, or discard this patch.
src/GuzzleRequestHandler.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
         $this->httpClient = $client;
50 50
     }
51 51
 
52
-	/**
53
-	 * @param string $uri
54
-	 *
55
-	 * @return ResponseInterface
56
-	 */
52
+ /**
53
+  * @param string $uri
54
+  *
55
+  * @return ResponseInterface
56
+  */
57 57
     public function get(string $uri): ResponseInterface
58 58
     {
59 59
         return $this->httpClient->get($uri);
@@ -112,27 +112,27 @@  discard block
 block discarded – undo
112 112
         return $deferred->promise();
113 113
     }
114 114
 
115
-	/**
116
-	 * @param string $uri
117
-	 *
118
-	 * @return PromiseInterface
119
-	 */
115
+ /**
116
+  * @param string $uri
117
+  *
118
+  * @return PromiseInterface
119
+  */
120 120
     public function getAsync(string $uri): PromiseInterface
121 121
     {
122
-	    $this->logger->debug('About to perform async HTTP call to Telegram\'s API');
123
-	    $deferred = new Deferred();
124
-
125
-	    $promise = $this->httpClient->getAsync($uri);
126
-	    $promise->then(function (ResponseInterface $response) use ($deferred) {
127
-		    $deferred->resolve(new TelegramRawData((string) $response->getBody()));
128
-	    },
129
-		    function (RequestException $exception) use ($deferred) {
130
-			    if (!empty($exception->getResponse()->getBody()))
131
-				    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
132
-			    else
133
-				    $deferred->reject($exception);
134
-		    });
135
-
136
-	    return $deferred->promise();
122
+     $this->logger->debug('About to perform async HTTP call to Telegram\'s API');
123
+     $deferred = new Deferred();
124
+
125
+     $promise = $this->httpClient->getAsync($uri);
126
+     $promise->then(function (ResponseInterface $response) use ($deferred) {
127
+      $deferred->resolve(new TelegramRawData((string) $response->getBody()));
128
+     },
129
+      function (RequestException $exception) use ($deferred) {
130
+       if (!empty($exception->getResponse()->getBody()))
131
+        $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
132
+       else
133
+        $deferred->reject($exception);
134
+      });
135
+
136
+     return $deferred->promise();
137 137
     }
138 138
 }
139 139
\ No newline at end of file
Please login to merge, or discard this patch.
src/RequestHandlerInterface.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
 
11 11
 interface RequestHandlerInterface
12 12
 {
13
-	/**
14
-	 * This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work
15
-	 *
16
-	 * @param string $uri
17
-	 * @param array $formFields
18
-	 *
19
-	 * @return TelegramRawData
20
-	 *
21
-	 */
13
+ /**
14
+  * This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work
15
+  *
16
+  * @param string $uri
17
+  * @param array $formFields
18
+  *
19
+  * @return TelegramRawData
20
+  *
21
+  */
22 22
     public function post(string $uri, array $formFields): TelegramRawData;
23 23
 
24 24
     /**
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function postAsync(string $uri, array $formFields): PromiseInterface;
38 38
 
39
-	/**
40
-	 * @param string $uri
41
-	 *
42
-	 * @return PromiseInterface
43
-	 */
44
-	public function getAsync(string $uri): PromiseInterface;
39
+ /**
40
+  * @param string $uri
41
+  *
42
+  * @return PromiseInterface
43
+  */
44
+ public function getAsync(string $uri): PromiseInterface;
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.