Conditions | 3 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
49 | 2 | public function runBot(BotInterface $bot, $maxTimesToPoll = null) |
|
50 | { |
||
51 | 2 | $this->loopCounter = 0; |
|
52 | |||
53 | 2 | $this->loop->addPeriodicTimer( |
|
54 | 2 | $this->loopTimeout, |
|
55 | 2 | function (\React\EventLoop\Timer\Timer $timer) use ($bot, $maxTimesToPoll) { |
|
56 | 2 | $bot->poll(); |
|
57 | 1 | $this->loopCounter++; |
|
58 | 1 | if (!is_null($maxTimesToPoll) && ($maxTimesToPoll >= $this->loopCounter)) { |
|
59 | 1 | $this->loop->cancelTimer($timer); |
|
60 | } |
||
61 | 2 | }); |
|
62 | |||
63 | 2 | $this->loop->run(); |
|
64 | 1 | } |
|
65 | } |
||
66 |