@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function getResult(): array |
102 | 102 | { |
103 | - return array_key_exists('result', $this->decodedData) ? (array) $this->decodedData['result'] : []; |
|
103 | + return array_key_exists('result', $this->decodedData) ? (array)$this->decodedData['result'] : []; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getResultBoolean(): bool |
112 | 112 | { |
113 | - return array_key_exists('result', $this->decodedData) ? (bool) $this->decodedData['result'] : false; |
|
113 | + return array_key_exists('result', $this->decodedData) ? (bool)$this->decodedData['result'] : false; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -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 | |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | $deferred = new Deferred(); |
61 | 61 | |
62 | 62 | $receivedData = ''; |
63 | - $request->on('response', function (Response $response) use ($deferred, &$receivedData) { |
|
64 | - $response->on('data', function ($chunk) use (&$receivedData) { |
|
63 | + $request->on('response', function(Response $response) use ($deferred, &$receivedData) { |
|
64 | + $response->on('data', function($chunk) use (&$receivedData) { |
|
65 | 65 | $receivedData .= $chunk; |
66 | 66 | }); |
67 | 67 | |
68 | - $response->on('end', function () use (&$receivedData, $deferred, $response) { |
|
68 | + $response->on('end', function() use (&$receivedData, $deferred, $response) { |
|
69 | 69 | $deferred->resolve(new TelegramResponse($receivedData, $response->getHeaders())); |
70 | 70 | }); |
71 | 71 | }); |
72 | 72 | |
73 | - $request->on('error', function (\Exception $exception) use ($deferred, $receivedData) { |
|
73 | + $request->on('error', function(\Exception $exception) use ($deferred, $receivedData) { |
|
74 | 74 | // First check if the data we received thus far actually is valid. |
75 | 75 | // Else, wipe it. |
76 | 76 | if (!json_decode($receivedData)) { |
@@ -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 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->requestHandler = $handler; |
73 | 73 | $this->formConstructor = new PostOptionsConstructor(); |
74 | - $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/'; |
|
74 | + $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->resetObjectValues(); |
86 | 86 | $option = $this->formConstructor->constructOptions($method); |
87 | 87 | return $this->sendRequestToTelegram($method, $option) |
88 | - ->then(function (TelegramResponse $response) use ($method) { |
|
88 | + ->then(function(TelegramResponse $response) use ($method) { |
|
89 | 89 | return $method::bindToObject($response, $this->logger); |
90 | 90 | }); |
91 | 91 | } |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | public function downloadFile(File $file): PromiseInterface |
99 | 99 | { |
100 | 100 | $this->logger->debug('Downloading file async from Telegram, creating URL'); |
101 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
101 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
102 | 102 | $this->logger->debug('About to perform request to begin downloading file'); |
103 | 103 | |
104 | 104 | $deferred = new Deferred(); |
105 | 105 | |
106 | 106 | $this->requestHandler->get($url)->then( |
107 | - function (TelegramResponse $rawData) use ($deferred) { |
|
107 | + function(TelegramResponse $rawData) use ($deferred) { |
|
108 | 108 | $deferred->resolve(new TelegramDocument($rawData)); |
109 | 109 | }, |
110 | - function (\Exception $exception) use ($deferred) { |
|
110 | + function(\Exception $exception) use ($deferred) { |
|
111 | 111 | $deferred->reject($exception); |
112 | 112 | } |
113 | 113 | ); |
@@ -155,6 +155,6 @@ discard block |
||
155 | 155 | $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1); |
156 | 156 | $this->logger->info('About to perform API request', ['method' => $this->methodName]); |
157 | 157 | |
158 | - return $this->apiUrl . $this->methodName; |
|
158 | + return $this->apiUrl.$this->methodName; |
|
159 | 159 | } |
160 | 160 | } |