public static function checkIfOAuthIsValid(array $settings){
      if (!isset($settings) || empty($settings)) {
          throw new SdkException("Empty OAuth Array passed. Can't construct ServiceContext based on Empty Array.");
      }

      if(!isset($settings['auth_mode'])){
          throw new SdkException("No OAuth 1 or OAuth 2 Mode specified. Can't validate OAuth tokens.");
      }

      $mode = $settings['auth_mode'];

      //OAuth 1 settings, OAuth 1 must provide all four values.
      if (strcasecmp($mode, CoreConstants::OAUTH1) == 0) {
        if (!isset($settings['accessTokenKey'])) {
            throw new SdkException("'accessTokenKey' must be provided in OAuth1.");
        }

        if (!isset($settings['accessTokenSecret'])) {
            throw new SdkException("'accessTokenSecret' must be provided in OAuth1.");
        }
      }
      //OAuth 2 settings, Only client ID and Client Secret is required. For making API call, all four values, Client ID, Client Secret, Access Token, Access Token Secret are required.
      else if(strcasecmp($mode, CoreConstants::OAUTH2) == 0){
        if (!isset($settings['ClientID'])) {
            throw new SdkException("'ClientID' must be provided in OAuth2.");
        }

        if (!isset($settings['ClientSecret'])) {
            throw new SdkException("'ClientSecret' must be provided in OAuth2.");
        }
      }
      //Now other OAuth is supported
      else{
        throw new SdkException("OAuth Mode is not supported.");
      }
    }
public static function checkIfOAuthIsValid(array $settings){
      if (!isset($settings) || empty($settings)) {
          throw new SdkException("Empty OAuth Array passed. Can't construct ServiceContext based on Empty Array.");
      }

      if(!isset($settings['auth_mode'])){
          throw new SdkException("No OAuth 1 or OAuth 2 Mode specified. Can't validate OAuth tokens.");
      }

      $mode = $settings['auth_mode'];

      //OAuth 1 settings, OAuth 1 must provide all four values.
      if (strcasecmp($mode, CoreConstants::OAUTH1) == 0) {
        if (!isset($settings['accessTokenKey'])) {
            throw new SdkException("'accessTokenKey' must be provided in OAuth1.");
        }

        if (!isset($settings['accessTokenSecret'])) {
            throw new SdkException("'accessTokenSecret' must be provided in OAuth1.");
        }
      }
      //OAuth 2 settings, Only client ID and Client Secret is required. For making API call, all four values, Client ID, Client Secret, Access Token, Access Token Secret are required.
      else if(strcasecmp($mode, CoreConstants::OAUTH2) == 0){
        if (!isset($settings['ClientID'])) {
            throw new SdkException("'ClientID' must be provided in OAuth2.");
        }

        if (!isset($settings['ClientSecret'])) {
            throw new SdkException("'ClientSecret' must be provided in OAuth2.");
        }
      }
      //Now other OAuth is supported
      else{
        throw new SdkException("OAuth Mode is not supported.");
      }
    }
public static function checkIfOAuthIsValid ( array $ settings ) { if ( ! isset ( $ settings ) || empty ( $ settings ) ) { throw new SdkException ( "Empty OAuth Array passed. Can't construct ServiceContext based on Empty Array." ) ; } if ( ! isset ( $ settings [ 'auth_mode' ] ) ) { throw new SdkException ( "No OAuth 1 or OAuth 2 Mode specified. Can't validate OAuth tokens." ) ; } $ mode = $ settings [ 'auth_mode' ] ; //OAuth 1 settings, OAuth 1 must provide all four values. if ( strcasecmp ( $ mode , CoreConstants :: OAUTH1 ) == 0 ) { if ( ! isset ( $ settings [ 'accessTokenKey' ] ) ) { throw new SdkException ( "'accessTokenKey' must be provided in OAuth1." ) ; } if ( ! isset ( $ settings [ 'accessTokenSecret' ] ) ) { throw new SdkException ( "'accessTokenSecret' must be provided in OAuth1." ) ; } } //OAuth 2 settings, Only client ID and Client Secret is required. For making API call, all four values, Client ID, Client Secret, Access Token, Access Token Secret are required. else if ( strcasecmp ( $ mode , CoreConstants :: OAUTH2 ) == 0 ) { if ( ! isset ( $ settings [ 'ClientID' ] ) ) { throw new SdkException ( "'ClientID' must be provided in OAuth2." ) ; } if ( ! isset ( $ settings [ 'ClientSecret' ] ) ) { throw new SdkException ( "'ClientSecret' must be provided in OAuth2." ) ; } } //Now other OAuth is supported else { throw new SdkException ( "OAuth Mode is not supported." ) ; } }
Check if passed array has mininum required fields

@param Array $settings        The array contain OAuth 1 or OAuth 2 settings
Check if passed array has mininum required fields