@@ -25,7 +25,6 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * @param CallableInterface $responseInterface |
|
29 | 28 | */ |
30 | 29 | public function poll($responseHandler) |
31 | 30 | { |
@@ -79,6 +78,10 @@ discard block |
||
79 | 78 | } |
80 | 79 | |
81 | 80 | |
81 | + /** |
|
82 | + * @param string $command |
|
83 | + * @param string $params |
|
84 | + */ |
|
82 | 85 | private function assembleUri($command, $params) :string |
83 | 86 | { |
84 | 87 | return sprintf( |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use TelegramBot\APIMessage; |
6 | 6 | use React\HttpClient\Client; |
7 | -use React\HttpClient\Request; |
|
8 | 7 | |
9 | 8 | class APIPollClient |
10 | 9 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->botCommand('getUpdates', ['offset' => $this->offset]) |
35 | 35 | ); |
36 | 36 | $request->on('response', $responseHandler); |
37 | - $request->on('error', function ($data) { |
|
37 | + $request->on('error', function($data) { |
|
38 | 38 | throw new \Exception($data); |
39 | 39 | }); |
40 | 40 | $request->end(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function markMessageHandled(APIMessage $message) |
61 | 61 | { |
62 | - $this->offset = $message->getUpdateId() +1; |
|
62 | + $this->offset = $message->getUpdateId()+1; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function getResponseHeaders(string $responseString) :array |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $client; |
17 | 17 | |
18 | 18 | /** |
19 | - * @param APIClient $client |
|
19 | + * @param APIPollClient $client |
|
20 | 20 | */ |
21 | 21 | public function __construct(APIPollClient $client) |
22 | 22 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @param APIMessage $message |
74 | - * @return function |
|
74 | + * @return \Closure |
|
75 | 75 | */ |
76 | 76 | public function getResponder(APIMessage $message) |
77 | 77 | { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | */ |
76 | 76 | public function getResponder(APIMessage $message) |
77 | 77 | { |
78 | - return function ($text) use ($message) { |
|
78 | + return function($text) use ($message) { |
|
79 | 79 | $this->client->send($text, $message); |
80 | 80 | }; |
81 | 81 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $counter = 0; |
42 | 42 | |
43 | - $this->loop->addPeriodicTimer(2, function (\React\EventLoop\Timer\Timer $timer) use ($bot, $maxTimesToPoll, &$counter) { |
|
43 | + $this->loop->addPeriodicTimer(2, function(\React\EventLoop\Timer\Timer $timer) use ($bot, $maxTimesToPoll, &$counter) { |
|
44 | 44 | $bot->poll(); |
45 | 45 | |
46 | 46 | if (!is_null($maxTimesToPoll) && ($maxTimesToPoll >= $counter)) { |