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
$taskHandler
private
TaskHandler|null
$taskHandler
= null
Methods
__construct()
public
__construct(Closure $closure) : mixed
Parameters
- $closure : Closure
-
Must accept zero parameters
Tags
Return values
mixed —getHandler()
public
final getHandler() : TaskHandler|null
Return values
TaskHandler|null —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