@@ -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 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->resetObjectValues(); |
88 | 88 | $option = $this->formConstructor->constructOptions($method); |
89 | 89 | return $this->sendRequestToTelegram($method, $option) |
90 | - ->then(function (TelegramResponse $response) use ($method) { |
|
90 | + ->then(function(TelegramResponse $response) use ($method) { |
|
91 | 91 | return $method::bindToObject($response, $this->logger); |
92 | 92 | }); |
93 | 93 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function downloadFile(File $file): PromiseInterface |
101 | 101 | { |
102 | - $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path; |
|
102 | + $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path; |
|
103 | 103 | $this->logger->debug('About to perform request to begin downloading file'); |
104 | 104 | |
105 | 105 | return $this->requestHandler->get($url)->then( |
106 | - function (TelegramResponse $rawData) { |
|
106 | + function(TelegramResponse $rawData) { |
|
107 | 107 | return new TelegramDocument($rawData); |
108 | 108 | } |
109 | 109 | ); |
@@ -149,6 +149,6 @@ discard block |
||
149 | 149 | $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1); |
150 | 150 | $this->logger->info('About to perform API request', ['method' => $this->methodName]); |
151 | 151 | |
152 | - return $this->apiUrl . $this->methodName; |
|
152 | + return $this->apiUrl.$this->methodName; |
|
153 | 153 | } |
154 | 154 | } |
@@ -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 | |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | $deferred = new Deferred(); |
62 | 62 | |
63 | 63 | $receivedData = ''; |
64 | - $request->on('response', function (Response $response) use ($deferred, &$receivedData) { |
|
65 | - $response->on('data', function ($chunk) use (&$receivedData) { |
|
64 | + $request->on('response', function(Response $response) use ($deferred, &$receivedData) { |
|
65 | + $response->on('data', function($chunk) use (&$receivedData) { |
|
66 | 66 | $receivedData .= $chunk; |
67 | 67 | }); |
68 | 68 | |
69 | - $response->on('end', function () use (&$receivedData, $deferred, $response) { |
|
69 | + $response->on('end', function() use (&$receivedData, $deferred, $response) { |
|
70 | 70 | try { |
71 | 71 | $endResponse = new TelegramResponse($receivedData, $response->getHeaders()); |
72 | 72 | $deferred->resolve($endResponse); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | }); |
78 | 78 | }); |
79 | 79 | |
80 | - $request->on('error', function (\Exception $e) use ($deferred) { |
|
80 | + $request->on('error', function(\Exception $e) use ($deferred) { |
|
81 | 81 | $deferred->reject(new ClientException($e->getMessage(), $e->getCode(), $e)); |
82 | 82 | }); |
83 | 83 |