mirror of
https://github.com/danog/loop.git
synced 2024-11-26 20:04:44 +01:00
49 lines
865 B
PHP
49 lines
865 B
PHP
<?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;
|
|
}
|