protected function generateImage(string $pumlDiagram, string $format): string
    {
        if ($format === VisualizerTask::FORMAT_PUML) {
            $this->log('Bypassing, no need to call server', Project::MSG_DEBUG);

            return $pumlDiagram;
        }

        $format = $this->getFormat();
        $encodedPuml = encodep($pumlDiagram);
        $this->prepareImageUrl($format, $encodedPuml);

        $response = $this->createRequest()->send();
        $this->processResponse($response); // used for status validation

        return $response->getBody();
    }