You are here

function rules_scheduler_task_handler in Rules 7.2

Returns the task handler for a given task.

Parameters

array $task: A task (queue item) array.

Return value

RulesSchedulerTaskHandlerInterface The task handler.

Throws

RulesEvaluationException If the task handler class is missing.

File

rules_scheduler/rules_scheduler.module, line 68
Rules scheduler module.

Code

function rules_scheduler_task_handler(array $task) {
  $class = !empty($task['handler']) ? $task['handler'] : 'RulesSchedulerDefaultTaskHandler';
  if (!class_exists($class)) {
    throw new RulesEvaluationException('Missing task handler implementation %class.', array(
      '%class' => $class,
    ), NULL, RulesLog::ERROR);
  }
  return new $class($task);
}