public function preparePharCacert($md5Check = true)
    {
        $from = __DIR__ . '/Resources/cacert.pem';
        $certFile = sys_get_temp_dir() . '/guzzle-cacert.pem';
        if (!file_exists($certFile) && !copy($from, $certFile)) {
            throw new RuntimeException("Could not copy {$from} to {$certFile}: " . var_export(error_get_last(), true));
        } elseif ($md5Check) {
            $actualMd5 = md5_file($certFile);
            $expectedMd5 = trim(file_get_contents("{$from}.md5"));
            if ($actualMd5 != $expectedMd5) {
                throw new RuntimeException("{$certFile} MD5 mismatch: expected {$expectedMd5} but got {$actualMd5}");
            }
        }

        return $certFile;
    }