Exemple #1
0
 /**
  * Set the API key to authenticate with.
  *
  * An API key is required to interact with the Battle.net API services. If
  * you do not have an API key, you must first go to http://dev.battle.net
  * and create an account. Once you have created an account and registered
  * your application with Battle.net, you will be assigned a unique API key
  * that you can use to make requests to the various API endpoints to
  * retrieve data. Without an API key, you will not be able to get a valid
  * response from the API.
  * @param string $key The API key to authenticate requests with.
  */
 public static function setKey($key)
 {
     try {
         if (!is_string($key)) {
             $keyVarType = gettype($key);
             throw new BattleNetAPI_Exception('The method setKey() expects the parameter $key to be a string, ' . $keyVarType . ' given.');
         }
         self::$key = $key;
     } catch (BattleNetAPI_Exception $exception) {
         $exception->showMessage();
     }
 }