Update README.md, consistent use of spaces instead of tabs, better examples
This commit is contained in:
@@ -6,32 +6,32 @@ use React\EventLoop\LoopInterface;
|
||||
|
||||
class Tasks
|
||||
{
|
||||
/** @var Task[] */
|
||||
private array $tasks;
|
||||
private ?LoopInterface $loop = null;
|
||||
/** @var Task[] */
|
||||
private array $tasks;
|
||||
private ?LoopInterface $loop = null;
|
||||
|
||||
public function __construct(Task ...$tasks)
|
||||
{
|
||||
$this->tasks = $tasks;
|
||||
}
|
||||
public function __construct(Task ...$tasks)
|
||||
{
|
||||
$this->tasks = $tasks;
|
||||
}
|
||||
|
||||
public function enable(LoopInterface $loop): void
|
||||
{
|
||||
if (is_null($this->loop)) {
|
||||
$this->loop = $loop;
|
||||
foreach ($this->tasks as $task) {
|
||||
$task->enable($this->loop);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function enable(LoopInterface $loop): void
|
||||
{
|
||||
if (is_null($this->loop)) {
|
||||
$this->loop = $loop;
|
||||
foreach ($this->tasks as $task) {
|
||||
$task->enable($this->loop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel(): void
|
||||
{
|
||||
if (!is_null($this->loop)) {
|
||||
foreach ($this->tasks as $task) {
|
||||
$task->cancel($this->loop);
|
||||
}
|
||||
$this->loop = null;
|
||||
}
|
||||
}
|
||||
public function cancel(): void
|
||||
{
|
||||
if (!is_null($this->loop)) {
|
||||
foreach ($this->tasks as $task) {
|
||||
$task->cancel($this->loop);
|
||||
}
|
||||
$this->loop = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user