/** * @param TaskDefinition $taskDef * @return AntTarget|GitResetHardPullProduction * @throws InvalidArgumentException */ public static function getTask(TaskDefinition $taskDef) { switch ($taskDef->getType()) { case TasksEnum::GIT_RESET_HARD_PULLPRODUCTION: return new GitResetHardPullProduction($taskDef->getName(), $taskDef->getWorkingDir()); case TasksEnum::ANT_TARGET: return new AntTarget($taskDef->getName(), $taskDef->getWorkingDir(), $taskDef->getProperty(AntTarget::TARGET)); default: throw new InvalidArgumentException('Invalid Task: ' . $taskDef->getType()); } }