function submitTask(\CharlotteDunois\Phoebe\AsyncTask $task) {
        if(!$task->id) {
            throw new \InvalidArgumentException('Async Task has no ID - did you call parent::__construct() in your constructor?');
        }
        
        return $this->submit($task)->then(function (\CharlotteDunois\Phoebe\Worker $worker) use (&$task) {
            $itask = new \CharlotteDunois\Phoebe\InternalTask($worker, $task);
            $this->tasks->set($task->id, $itask);
            
            return $itask->getDeferred()->promise();
        });
    }
function submitTask(\CharlotteDunois\Phoebe\AsyncTask $task) {
        if(!$task->id) {
            throw new \InvalidArgumentException('Async Task has no ID - did you call parent::__construct() in your constructor?');
        }
        
        return $this->submit($task)->then(function (\CharlotteDunois\Phoebe\Worker $worker) use (&$task) {
            $itask = new \CharlotteDunois\Phoebe\InternalTask($worker, $task);
            $this->tasks->set($task->id, $itask);
            
            return $itask->getDeferred()->promise();
        });
    }
function submitTask ( \ CharlotteDunois \ Phoebe \ AsyncTask $ task ) { if ( ! $ task -> id ) { throw new \ InvalidArgumentException ( 'Async Task has no ID - did you call parent::__construct() in your constructor?' ) ; } return $ this -> submit ( $ task ) -> then ( function ( \ CharlotteDunois \ Phoebe \ Worker $ worker ) use ( & $ task ) { $ itask = new \ CharlotteDunois \ Phoebe \ InternalTask ( $ worker , $ task ) ; $ this -> tasks -> set ( $ task -> id , $ itask ) ; return $ itask -> getDeferred ( ) -> promise ( ) ; } ) ; }
Submits the task to a worker and returns a promise which resolves or rejects with the resolve value of the task.
@param \CharlotteDunois\Phoebe\AsyncTask  $task
@return \React\Promise\ExtendedPromiseInterface
@throws \InvalidArgumentException
Submits the task to a worker and returns a promise which resolves or rejects with the resolve value of the task .