protected function getSSLBuilder($config)
    {
        if (empty($config)) {
            return null;
        }

        $ssl = \Cassandra::ssl();
        $serverCert = array_get($config, 'server_cert_path');
        $clientCert = array_get($config, 'client_cert_path');
        $privateKey = array_get($config, 'private_key_path');
        $passPhrase = array_get($config, 'key_pass_phrase');

        if (!empty($serverCert) && !empty($clientCert)) {
            if (empty($privateKey)) {
                throw new InternalServerErrorException('No private key provider.');
            }

            return $ssl->withVerifyFlags(\Cassandra::VERIFY_PEER_CERT)
                ->withTrustedCerts($serverCert)
                ->withClientCert($clientCert)
                ->withPrivateKey($privateKey, $passPhrase)
                ->build();
        } elseif (!empty($serverCert)) {
            return $ssl->withVerifyFlags(\Cassandra::VERIFY_PEER_CERT)
                ->withTrustedCerts(getenv('SERVER_CERT'))
                ->build();
        } elseif (true === boolval(array_get($config, 'ssl', array_get($config, 'tls', false)))) {
            return $ssl->withVerifyFlags(\Cassandra::VERIFY_NONE)
                ->build();
        } else {
            return null;
        }
    }