public function __construct(HandlerInterface $handler, callable $task, array $args = []) { if ($handler->getTaskId()) { throw new \InvalidArgumentException('$handler already has a TaskId set'); } array_unshift($args, $handler); $this->handler = $handler; $this->task = $task; $this->args = $args; }
public function task(HandlerInterface $handler) { sleep(1); $handler->complete(); }