Completed
Pull Request — master (#51)
by Rick
02:01
created
src/TgLog.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	public function downloadFile(File $file): TelegramDocument
134 134
 	{
135 135
 		$this->logger->debug('Downloading file from Telegram, creating URL');
136
-		$url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
136
+		$url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
137 137
 		$this->logger->debug('About to perform request to begin downloading file');
138 138
 		return new TelegramDocument($this->requestHandler->get($url));
139 139
 	}
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 	public function downloadFileAsync(File $file): PromiseInterface
147 147
 	{
148 148
 		$this->logger->debug('Downloading file async from Telegram, creating URL');
149
-		$url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
149
+		$url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
150 150
 		$this->logger->debug('About to perform request to begin downloading file');
151 151
 
152 152
 		$deferred = new Promise();
153 153
 
154
-		return $this->requestHandler->requestAsync($url)->then(function (ResponseInterface $response) use ($deferred)
154
+		return $this->requestHandler->requestAsync($url)->then(function(ResponseInterface $response) use ($deferred)
155 155
 		{
156 156
 			$deferred->resolve(new TelegramDocument($response));
157 157
 		},
158
-			function (RequestException $exception) use ($deferred)
158
+			function(RequestException $exception) use ($deferred)
159 159
 			{
160 160
 				if (!empty($exception->getResponse()->getBody()))
161 161
 					$deferred->resolve(new TelegramDocument($exception->getResponse()));
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	final private function constructApiUrl(): TgLog
172 172
 	{
173
-		$this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/';
173
+		$this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/';
174 174
 		$this->logger->debug('Built up the API URL');
175 175
 		return $this;
176 176
 	}
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 		$deferred = new Promise();
214 214
 
215 215
 		$promise = $this->requestHandler->requestAsync($this->composeApiMethodUrl($method), $formData);
216
-		$promise->then(function (ResponseInterface $response) use ($deferred)
216
+		$promise->then(function(ResponseInterface $response) use ($deferred)
217 217
 		{
218
-			$deferred->resolve(new TelegramRawData((string) $response->getBody()));
218
+			$deferred->resolve(new TelegramRawData((string)$response->getBody()));
219 219
 		},
220
-			function (RequestException $exception) use ($deferred)
220
+			function(RequestException $exception) use ($deferred)
221 221
 			{
222 222
 				if (!empty($exception->getResponse()->getBody()))
223
-					$deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
223
+					$deferred->resolve(new TelegramRawData((string)$exception->getResponse()->getBody(), $exception));
224 224
 				else
225 225
 					$deferred->reject($exception);
226 226
 			});
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
329 329
 		$this->logger->info('About to perform API request', ['method' => $this->methodName]);
330 330
 
331
-		return $this->apiUrl . $this->methodName;
331
+		return $this->apiUrl.$this->methodName;
332 332
 	}
333 333
 
334 334
 	/**
Please login to merge, or discard this patch.
src/GuzzleRequestHandler.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param ClientInterface $client
35 35
 	 * @param LoggerInterface $logger
36 36
 	 */
37
-	public function __construct(?ClientInterface $client = null, LoggerInterface $logger = null)
37
+	public function __construct(? ClientInterface $client = null, LoggerInterface $logger = null)
38 38
 	{
39 39
 		if ($logger === null)
40 40
 		{
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			}
79 79
 		}
80 80
 		finally {
81
-			return new TelegramRawData((string) $response->getBody(), $e);
81
+			return new TelegramRawData((string)$response->getBody(), $e);
82 82
 		}
83 83
 	}
84 84
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 		$deferred = new Promise();
95 95
 
96 96
 		$promise = $this->httpClient->postAsync($uri, $formData);
97
-		$promise->then(function (ResponseInterface $response) use ($deferred) {
98
-			$deferred->resolve(new TelegramRawData((string) $response->getBody()));
97
+		$promise->then(function(ResponseInterface $response) use ($deferred) {
98
+			$deferred->resolve(new TelegramRawData((string)$response->getBody()));
99 99
 		},
100
-			function (RequestException $exception) use ($deferred) {
100
+			function(RequestException $exception) use ($deferred) {
101 101
 				if (!empty($exception->getResponse()->getBody()))
102
-					$deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception));
102
+					$deferred->resolve(new TelegramRawData((string)$exception->getResponse()->getBody(), $exception));
103 103
 				else
104 104
 					$deferred->reject($exception);
105 105
 			});
Please login to merge, or discard this patch.