@@ -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 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $this->requestHandler = $handler; |
72 | 72 | $this->formConstructor = new PostOptionsConstructor(); |
73 | - $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/'; |
|
73 | + $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->resetObjectValues(); |
85 | 85 | $option = $this->formConstructor->constructOptions($method); |
86 | 86 | return $this->sendRequestToTelegram($method, $option) |
87 | - ->then(function (TelegramResponse $response) use ($method) { |
|
87 | + ->then(function(TelegramResponse $response) use ($method) { |
|
88 | 88 | return $method::bindToObject($response, $this->logger); |
89 | 89 | }); |
90 | 90 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function downloadFile(File $file): PromiseInterface |
98 | 98 | { |
99 | 99 | $this->logger->debug('Downloading file async from Telegram, creating URL'); |
100 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
100 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
101 | 101 | $this->logger->debug('About to perform request to begin downloading file'); |
102 | 102 | |
103 | 103 | return $this->requestHandler->get($url)->then( |
104 | - function (TelegramResponse $rawData) { |
|
104 | + function(TelegramResponse $rawData) { |
|
105 | 105 | return new TelegramDocument($rawData); |
106 | 106 | } |
107 | 107 | ); |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1); |
148 | 148 | $this->logger->info('About to perform API request', ['method' => $this->methodName]); |
149 | 149 | |
150 | - return $this->apiUrl . $this->methodName; |
|
150 | + return $this->apiUrl.$this->methodName; |
|
151 | 151 | } |
152 | 152 | } |