private function downloadTemporaryFile($url, $target)
    {
        try {
            if (($fh = @fopen($target, 'w')) === false) {
                throw new RuntimeException(
                    sprintf(
                        'Could not create file "%s": %s',
                        $target,
                        @error_get_last()['message']
                    )
                );
            }

            if ((@fwrite($fh, $this->httpClient->get($url, 'application/octet-stream'))) === false) {
                throw new RuntimeException(
                    sprintf(
                        'The "%s" file could not be downloaded: %s',
                        $url,
                        @error_get_last()['message']
                    )
                );
            }
        } finally {
            if (is_resource($fh)) {
                fclose($fh);
            }
        }
    }