TaskManager
TaskManager

Manages the task queue and runs scheduled tasks.

Functions
getAll
public function getAll()

Gets all tasks in the current queue.

Returns

An array of task instances.

getByName
public function getByName(
$class_name
)

Gets tasks of the given class name.  Note that this only gets exact matches.  It will not get tasks that are a subclass of the given class

Parameters
class_name

The full name, with namespace, of the desired class

Returns

An array of task instances.

add
public function add(
Task $task
)

Add a task to the queue.

Parameters
task
Task$

The task to add.

remove
public function remove(
Task $task null
)

Removes a task from the queue.

Parameters
task
Task$

The task to remove.

findByKey
public function findByKey(
Task $task
)

Find a task that has the same key value as the parameter.

Parameters
task
Task$

A task that has the desired key value.

Returns

A Task instance or null if not found.

runPendingTasks
public function runPendingTasks(
DateTime $current_time null
)

Executes any tasks that are ready to be run.  After executing, this will remove any tasks that indicate they should be deleted, i.e. one-shot tasks.