protected function createNexmoClient(Config $config)
    {
        // Check for Nexmo config file.
        if (! $this->hasNexmoConfigSection()) {
            $this->raiseRunTimeException('Missing nexmo configuration section.');
        }

        // Get Client Options.
        $options = array_diff_key($config->get('nexmo'), ['private_key', 'application_id', 'api_key', 'api_secret', 'shared_secret']);

        // Do we have a private key?
        $privateKeyCredentials = null;
        if ($this->nexmoConfigHas('private_key')) {
            if ($this->nexmoConfigHasNo('application_id')) {
                $this->raiseRunTimeException('You must provide nexmo.application_id when using a private key');
            }

            $privateKeyCredentials = $this->createPrivateKeyCredentials($config->get('nexmo.private_key'), $config->get('nexmo.application_id'));
        }

        $basicCredentials = null;
        if ($this->nexmoConfigHas('api_secret')) {
            $basicCredentials = $this->createBasicCredentials($config->get('nexmo.api_key'), $config->get('nexmo.api_secret'));
        }

        $signatureCredentials = null;
        if ($this->nexmoConfigHas('signature_secret')) {
            $signatureCredentials = $this->createSignatureCredentials($config->get('nexmo.api_key'), $config->get('nexmo.signature_secret'));
        }

        // We can have basic only, signature only, private key only or
        // we can have private key + basic/signature, so let's work out
        // what's been provided
        if ($basicCredentials && $signatureCredentials) {
            $this->raiseRunTimeException('Provide either nexmo.api_secret or nexmo.signature_secret');
        }

        if ($privateKeyCredentials && $basicCredentials) {
            $credentials = new Client\Credentials\Container(
                $privateKeyCredentials,
                $basicCredentials
            );
        } else if ($privateKeyCredentials && $signatureCredentials) {
            $credentials = new Client\Credentials\Container(
                $privateKeyCredentials,
                $signatureCredentials
            );
        } else if ($privateKeyCredentials) {
            $credentials = $privateKeyCredentials;
        } else if ($signatureCredentials) {
            $credentials = $signatureCredentials;
        } else if ($basicCredentials) {
            $credentials = $basicCredentials;
        } else {
            $possibleNexmoKeys = [
                'api_key + api_secret',
                'api_key + signature_secret',
                'private_key + application_id',
                'api_key + api_secret + private_key + application_id',
                'api_key + signature_secret + private_key + application_id',
            ];
            $this->raiseRunTimeException(
                'Please provide Nexmo API credentials. Possible combinations: '
                . join(", ", $possibleNexmoKeys)
            );
        }

        return new Client($credentials, $options);
    }