login($config['user'], PublicKeyLoader::load(file_get_contents($config['private_key_file'])))) { throw new \Exception('Login failed'); } $commands = []; foreach ($config['tasks'] as $task) { /**@var Task $task*/ if (! $task->module->checkState()) { $output->writeln('Adding commands from ' . get_class($task->module)); array_push($commands, ...$task->module->getCommands()); } else { $output->writeln('Skipping commands from ' . get_class($task->module)); } } $ssh->exec(implode(PHP_EOL, $commands)); return Command::SUCCESS; } }