/**
  * Executes command
  *
  * @param $workerId
  * @param WorkerListener $listener
  * @return mixed
  */
 public function execute($workerId, WorkerListener $listener)
 {
     $worker = $this->repository->killWorker($workerId);
     $this->log->info('Worker Killed', $worker->toArray());
     $this->destroyConfiguration($worker);
     return $listener->redirectWorker($worker);
 }
 /**
  * Executes the command
  *
  * @param $domainId
  * @param $workerData
  * @param WorkerListener $listener
  * @return mixed
  */
 public function execute($domainId, $workerData, WorkerListener $listener)
 {
     if (empty($workerData['environment'])) {
         $workerData['environment'] = 'production';
     }
     $worker = $this->repository->addNewWorker($domainId, $workerData);
     $this->log->info('Worker Created', $worker->toArray());
     $this->storeSupervisordConfig($worker);
     return $listener->redirectWorker($worker);
 }