Abstract Task that should be extend by domain specific tasks.

Using this base class, you only need define __invoke() to perform your task.

Alternatively, extend GenericTask and assign callable to GenericTask::$callback

Another alternative would be a class that implements TaskInterface and all the methods therein.

abstract class AbstractTask extends CallbackEvent implements TaskInterface

Traits

CallbackEventAttributeTrait
ContextAwareTrait
EventMutexFactoryTrait
MutexTrait
OutputAwareTrait
TaskAttributeTrait
TaskLogTrait

Constants

FREQUENCY_DEFAULT

DESCRIPTION_DEFAULT

MUTEX_TYPE_DEFAULT

MUTEX_ALLOW_OVERLAP

Properties summary

Type Property Description
protected $callback

Methods summary

Return Type Method Name Description
__construct(string $callback = null, array $parameters = []) Create a new event instance.
mixed run(Container $container) Execute the task
bool isDue(Application $app) -
bool expressionPasses() Ensure $expression has been set property
array toArray() -
ContextInterface getContext() -
getOutput() -

Details

__construct (string $callback = null, array $parameters = [])

Create a new event instance.

If $callback is not provided, __invoke() will be used if present, otherwise an empty lambda will be used

Parameters

string $callback
array $parameters

mixed run (Container $container)

Execute the task

  • Create the mutex
  • Run the callback
  • Delete the mutex
  • Run any after callbacks

Parameters

Container $container

Return Value

mixed

bool isDue (Application $app)

Parameters

Application $app

Return Value

bool

protected bool expressionPasses ()

Ensure $expression has been set property

Return Value

bool

array toArray ()

Return Value

array

ContextInterface getContext ()

Return Value

ContextInterface

getOutput ()