public function __construct() { $iCallLimit = BACKPACK_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 XBackpackLimitException("Exceeded limit requests (" . $iCallLimit . " per 5 minutes)"); } else { if ($iNow - self::$_iStartTime > self::iSeconds) { self::$_iCounter = 0; self::$_iStartTime = time(); } } } self::$_iCounter++; self::$_iElapsedTime = $iNow - self::$_iStartTime; }
/** * */ public function __construct($sAccountName, $iHTTPMethod, $sRESTURL, $bHTTPS = true) { $sBpDomain = "backpackit.com"; $this->_sAccountName = $sAccountName; $this->_iHTTPMethod = $iHTTPMethod; $this->_sRESTURL = $sRESTURL; if ($bHTTPS) { $this->_sProtocol = "https"; } else { $this->_sProtocol = "http"; } $this->_sURL = $this->_sProtocol . "://" . $this->_sAccountName . "." . $sBpDomain . $this->_sRESTURL; $this->_oConnection = new CHTTPCurl($this->_sURL, $this->_iHTTPMethod); parent::__construct(); }