예제 #1
0
 /**
  * Returns the instance of the API.
  * @return VPSNET
  */
 public static function getInstance($username = '', $_auth_api_key = '', $proxy = '')
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
         self::$instance->_auth_name = $username;
         self::$instance->_auth_api_key = $_auth_api_key;
         if (strlen($proxy) > 0) {
             self::$instance->_proxy = $proxy;
         }
         if (strlen($username) == 0 || strlen($_auth_api_key) == 0) {
             trigger_error('Singleton has been called for the first time and a username or API Key has not been set.', E_USER_ERROR);
         }
         self::$instance->_initCurl();
     }
     return self::$instance;
 }