/** * Flush the callback queue. * * Invokes callbacks which were on the queue when tick() was called and newly added ones. */ public function tick() { while (!$this->queue->isEmpty() && $this->loop->isRunning()) { $this->callback = $this->queue->dequeue(); $callback = $this->callback; // without this proxy PHPStorm marks line as fatal error. $callback($this->loop); } }
/** * @override * @inheritDoc */ public function isRunning() { return $this->loop->isRunning(); }
/** * @dataProvider loopsProvider * @param LoopExtendedInterface|LoopModelInterface|mixed $loop */ public function testApiStartAndApiStop_StartsAndStopsLoop($loop) { $loop->onAfterTick(function () use($loop) { $this->assertTrue($loop->isRunning()); $loop->stop(); $this->assertFalse($loop->isRunning()); }); $loop->start(); unset($loop); }