public static function getInstance($clientId, $clientSecret, $redirectUri)
{
$driver = static::getLibrary();
try {
$instance = new $driver($clientId, $clientSecret, $redirectUri);
} catch (\Exception $e) {
throw new TwitterOAuthException('Unable to create an instance of ' . $driver);
}
if (!self::isInstanceOf($instance, '\\Webiny\\Component\\TwitterOAuth\\Bridge\\TwitterOAuthInterface')) {
throw new TwitterOAuthException(TwitterOAuthException::MSG_INVALID_ARG, ['driver', '\\Webiny\\Component\\OAuth2\\TwitterOAuth\\TwitterOAuthInterface']);
}
return $instance;
}