protected function createClientCredentials(array $clientCredentials)
    {
        $keys = array('identifier', 'secret');

        foreach ($keys as $key) {
            if (!isset($clientCredentials[$key])) {
                throw new \InvalidArgumentException("Missing client credentials key [$key] from options.");
            }
        }

        if (isset($clientCredentials['rsa_private_key']) && isset($clientCredentials['rsa_public_key'])) {
            $_clientCredentials = new RsaClientCredentials();
            $_clientCredentials->setRsaPrivateKey($clientCredentials['rsa_private_key']);
            $_clientCredentials->setRsaPublicKey($clientCredentials['rsa_public_key']);
        } else {
            $_clientCredentials = new ClientCredentials();
        }

        $_clientCredentials->setIdentifier($clientCredentials['identifier']);
        $_clientCredentials->setSecret($clientCredentials['secret']);

        if (isset($clientCredentials['callback_uri'])) {
            $_clientCredentials->setCallbackUri($clientCredentials['callback_uri']);
        }

        return $_clientCredentials;
    }
protected function createClientCredentials(array $clientCredentials)
    {
        $keys = array('identifier', 'secret');

        foreach ($keys as $key) {
            if (!isset($clientCredentials[$key])) {
                throw new \InvalidArgumentException("Missing client credentials key [$key] from options.");
            }
        }

        if (isset($clientCredentials['rsa_private_key']) && isset($clientCredentials['rsa_public_key'])) {
            $_clientCredentials = new RsaClientCredentials();
            $_clientCredentials->setRsaPrivateKey($clientCredentials['rsa_private_key']);
            $_clientCredentials->setRsaPublicKey($clientCredentials['rsa_public_key']);
        } else {
            $_clientCredentials = new ClientCredentials();
        }

        $_clientCredentials->setIdentifier($clientCredentials['identifier']);
        $_clientCredentials->setSecret($clientCredentials['secret']);

        if (isset($clientCredentials['callback_uri'])) {
            $_clientCredentials->setCallbackUri($clientCredentials['callback_uri']);
        }

        return $_clientCredentials;
    }
protected function createClientCredentials ( array $ clientCredentials ) { $ keys = array ( 'identifier' , 'secret' ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ clientCredentials [ $ key ] ) ) { throw new \ InvalidArgumentException ( "Missing client credentials key [$key] from options." ) ; } } if ( isset ( $ clientCredentials [ 'rsa_private_key' ] ) && isset ( $ clientCredentials [ 'rsa_public_key' ] ) ) { $ _clientCredentials = new RsaClientCredentials ( ) ; $ _clientCredentials -> setRsaPrivateKey ( $ clientCredentials [ 'rsa_private_key' ] ) ; $ _clientCredentials -> setRsaPublicKey ( $ clientCredentials [ 'rsa_public_key' ] ) ; } else { $ _clientCredentials = new ClientCredentials ( ) ; } $ _clientCredentials -> setIdentifier ( $ clientCredentials [ 'identifier' ] ) ; $ _clientCredentials -> setSecret ( $ clientCredentials [ 'secret' ] ) ; if ( isset ( $ clientCredentials [ 'callback_uri' ] ) ) { $ _clientCredentials -> setCallbackUri ( $ clientCredentials [ 'callback_uri' ] ) ; } return $ _clientCredentials ; }
Creates a client credentials instance from an array of credentials.

@param array $clientCredentials

@return ClientCredentials
Creates a client credentials instance from an array of credentials .