Documentation

ClosureTask extends Task
in package

Task implementation which allows closures to be called by a scheduler.

Example usage:

TaskScheduler->scheduleTask(new ClosureTask(function() : void{
    echo "HI\n";
});

Table of Contents

$closure  : Closure
$taskHandler  : TaskHandler|null
__construct()  : mixed
getHandler()  : TaskHandler|null
getName()  : string
onCancel()  : void
Actions to execute if the Task is cancelled
onRun()  : void
Actions to execute when run
setHandler()  : void

Properties

$closure

private Closure $closure
Tags
phpstan-var

\Closure() : void

Methods

__construct()

public __construct(Closure $closure) : mixed
Parameters
$closure : Closure

Must accept zero parameters

Tags
phpstan-param

\Closure() : void $closure

Return values
mixed

getName()

public getName() : string
Return values
string

onCancel()

Actions to execute if the Task is cancelled

public onCancel() : void
Return values
void

onRun()

Actions to execute when run

public onRun() : void
Return values
void

setHandler()

public final setHandler(TaskHandler|null $taskHandler) : void
Parameters
$taskHandler : TaskHandler|null
Return values
void

Search results