* @copyright 2016-2020 Daniil Gentili * @license https://opensource.org/licenses/MIT MIT */ namespace danog\Loop\Test\Traits; use danog\Loop\Test\LoopTest; use function Amp\delay; trait Basic { use Logging; /** * Check whether the loop inited. * * @var bool */ private $inited = false; /** * Check whether the loop ran. * * @var bool */ private $ran = false; /** * Check whether the loop inited. */ public function inited(): bool { return $this->inited; } /** * Check whether the loop ran. */ public function ran(): bool { return $this->ran; } /** * Loop implementation. */ public function loop(): void { $this->inited = true; delay(100); $this->ran = true; } /** * Get loop name. * */ public function __toString(): string { return LoopTest::LOOP_NAME; } }