/** * */ private function stop() { if ($this->loop !== null && $this->loop->isRunning()) { $this->loop->stop(); } if ($this->stopFlags === false) { $callable = $this->stopCallback; $callable($this); } $this->stopFlags = true; }
/** * @override * @inheritDoc */ public function swap(LoopExtendedInterface $loop, $all = false) { $this->loop->swap($loop->getModel(), $all); return $this; }
/** * @override * @inheritDoc */ public function setLoop(LoopExtendedInterface $loop = null) { $this->loop = $loop; $this->loopBackup = $loop !== null ? new Loop($this->reflect($this->loop->getModel())) : $loop; }
/** * @dataProvider loopsProvider * @param LoopExtendedInterface|LoopModelInterface|mixed $loop */ public function testApiFlush_FlushesAllHandlers_WhenAllFlagSetToTrue($loop) { $stream = $this->createStream(); $loop->onAfterTick($this->expectCallableNever()); $loop->onBeforeTick($this->expectCallableNever()); $loop->addWriteStream($stream, $this->expectCallableNever()); $loop->addReadStream($stream, $this->expectCallableNever()); $loop->erase(true); $loop->tick(); unset($stream); unset($loop); }
/** * */ public function testApiGetModel_ReturnsModel() { $this->assertSame($this->model, $this->loop->getModel()); }
/** * */ public function setUp() { $this->loop = new Loop(new SelectLoop()); $this->loop->erase(true); $this->simulation = new Simulation($this->loop); }