/** * Generates a symfony2 console command to execute from the task * * @param WorkPackage $work * @throws TaskCommandGeneratorException * @return string */ public function generate(WorkPackage $work) { $description = $work->getTaskDescription(); $command = $description->getCommand(); if (!$this->isValidCommand($command)) { throw new TaskCommandGeneratorException("This command is not usable '{$command}' is not valid"); } $cmd = escapeshellarg($command); $cmd .= $this->generateArguments($description); $cmd .= $this->generateOptions($description); return $cmd; }