public function __construct()
 {
     $iCallLimit = BASECAMP_API_CALL_LIMIT;
     $iNow = time();
     if (self::$_iStartTime == 0) {
         self::$_iStartTime = time();
     } else {
         if ($iNow - self::$_iStartTime < $iCallLimit && self::$_iCounter >= $iCallLimit || self::$_iCounter >= $iCallLimit) {
             throw new XBasecampLimitException("Exceeded limit requests (" . $iCallLimit . " per " . $iSeconds . " seconds)");
         } else {
             if ($iNow - self::$_iStartTime > self::iSeconds) {
                 self::$_iCounter = 0;
                 self::$_iStartTime = time();
             }
         }
     }
     self::$_iCounter++;
     self::$_iElapsedTime = $iNow - self::$_iStartTime;
 }
Ejemplo n.º 2
0
 /**
  *	
  */
 public function __construct($sAccountName, $sToken, $ciHTTPMethod, $sRESTURL, $bHTTPS = true)
 {
     $sBpDomain = "basecamphq.com";
     $this->_sAccountName = $sAccountName;
     $this->_iHTTPMethod = $ciHTTPMethod;
     $this->_sRESTURL = $sRESTURL;
     if ($bHTTPS) {
         $this->_sProtocol = "https";
     } else {
         $this->_sProtocol = "http";
     }
     $this->_sURL = $this->_sProtocol . "://" . $this->_sAccountName . "." . $sBpDomain . $this->_sRESTURL;
     $this->_iContentLength = 0;
     $this->_oConnection = new CHTTPCurl($this->_sURL, $this->_iHTTPMethod, $sToken, "X");
     parent::__construct();
 }