1
0
mirror of https://github.com/danog/loop.git synced 2024-12-12 09:19:45 +01:00
loop/lib/LoopInterface.php

49 lines
865 B
PHP
Raw Normal View History

2020-07-21 18:06:19 +02:00
<?php
/**
* Loop interface.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2020 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/MIT MIT
*/
namespace danog\Loop;
use Amp\Promise;
/**
* Loop interface.
*
* @author Daniil Gentili <daniil@daniil.it>
*/
interface LoopInterface
{
/**
* Start the loop.
*
* Returns false if the loop is already running.
*
* @return bool
*/
public function start(): bool;
/**
* The actual loop function.
*
* @return \Generator
*/
public function loop(): \Generator;
/**
* Get name of the loop.
*
* @return string
*/
public function __toString(): string;
/**
* Check whether loop is running.
*
* @return boolean
*/
public function isRunning(): bool;
}