1
0
mirror of https://github.com/danog/loop.git synced 2024-12-04 10:18:02 +01:00
loop/lib/Interfaces/LoopInterface.php

47 lines
857 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
*/
2020-07-21 21:45:22 +02:00
namespace danog\Loop\Interfaces;
2020-07-21 18:06:19 +02:00
/**
* Loop interface.
*
* @author Daniil Gentili <daniil@daniil.it>
*/
interface LoopInterface
{
/**
* Start the loop.
2020-07-21 21:45:22 +02:00
*
2020-07-21 18:06:19 +02:00
* 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;
}