Completed
Pull Request — master (#53)
by Rick
02:13
created
src/TgLog.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -156,10 +156,11 @@  discard block
 block discarded – undo
156 156
         },
157 157
             function (\Exception $exception) use ($deferred)
158 158
             {
159
-                if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody()))
160
-                    $deferred->resolve(new TelegramDocument($exception->getResponse()));
161
-                else
162
-                    $deferred->reject($exception);
159
+                if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) {
160
+                                    $deferred->resolve(new TelegramDocument($exception->getResponse()));
161
+                } else {
162
+                                    $deferred->reject($exception);
163
+                }
163 164
             });
164 165
     }
165 166
 
@@ -218,10 +219,11 @@  discard block
 block discarded – undo
218 219
         },
219 220
             function (\Exception $exception) use ($deferred)
220 221
             {
221
-                if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody()))
222
-                    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
223
-                else
224
-                    $deferred->reject($exception);
222
+                if (method_exists($exception, 'getResponse') && !empty($exception->getResponse()->getBody())) {
223
+                                    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
224
+                } else {
225
+                                    $deferred->reject($exception);
226
+                }
225 227
             });
226 228
 
227 229
         return $deferred->promise();
Please login to merge, or discard this patch.
src/GuzzleRequestHandler.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,15 +74,13 @@  discard block
 block discarded – undo
74 74
         try {
75 75
             $response = $this->httpClient->post($uri, $formData);
76 76
             $this->logger->debug('Got response back from Telegram, applying json_decode');
77
-        }
78
-        catch (ClientException $e) {
77
+        } catch (ClientException $e) {
79 78
             $response = $e->getResponse();
80 79
             // It can happen that we have a network problem, in such case, we can't do nothing about it, so rethrow
81 80
             if (empty($response)) {
82 81
                 throw $e;
83 82
             }
84
-        }
85
-        finally {
83
+        } finally {
86 84
             return new TelegramRawData((string) $response->getBody(), $e);
87 85
         }
88 86
     }
@@ -103,10 +101,11 @@  discard block
 block discarded – undo
103 101
             $deferred->resolve(new TelegramRawData((string) $response->getBody()));
104 102
         },
105 103
             function (RequestException $exception) use ($deferred) {
106
-                if (!empty($exception->getResponse()->getBody()))
107
-                    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
108
-                else
109
-                    $deferred->reject($exception);
104
+                if (!empty($exception->getResponse()->getBody())) {
105
+                                    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
106
+                } else {
107
+                                    $deferred->reject($exception);
108
+                }
110 109
             });
111 110
 
112 111
         return $deferred->promise();
@@ -127,10 +126,11 @@  discard block
 block discarded – undo
127 126
 		    $deferred->resolve(new TelegramRawData((string) $response->getBody()));
128 127
 	    },
129 128
 		    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);
129
+			    if (!empty($exception->getResponse()->getBody())) {
130
+			    				    $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
131
+			    } else {
132
+			    				    $deferred->reject($exception);
133
+			    }
134 134
 		    });
135 135
 
136 136
 	    return $deferred->promise();
Please login to merge, or discard this patch.