callback = $callback; $this->arguments = $arguments; $this->title = $title; } /** * Perform the task. * * @param array $taskCtx * Array with keys: * - log: object 'Log' * * @throws Exception * @return bool, TRUE if task completes successfully */ public function run($taskCtx) { $args = $this->arguments; array_unshift($args, $taskCtx); if (is_callable($this->callback)) { $result = call_user_func_array($this->callback, $args); return $result; } else { throw new Exception('Failed to call callback: ' . print_r($this->callback)); } } }