Example #1
0
 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;
 }
Example #2
0
 public function task(HandlerInterface $handler)
 {
     sleep(1);
     $handler->complete();
 }