Jake Vanderwerf
2026-08-25 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a
inc/integrations/_Base.php
@@ -31,14 +31,7 @@
   protected string $apiVersion;
   protected Cache $cache;
   protected ?string $cacheName = null;
   //Use Trait "Requests" to set this
   protected bool $hasRequests = false;
   protected ?RateLimits $requestLimiter = null;
   //Use Trait "OAuth" to set this
   protected ?RateLimits $oauthLimiter = null;
   protected bool $hasOAuth = false;
   //Use trait "Webhooks" to set this true
   protected bool $hasWebhooks = false;
   /**
    * @var array Each item in the array becomes a li element in the ordered list of instructions
@@ -61,7 +54,7 @@
    * @var bool Flag to indicate there are extra options that warrant a dedicated options page for this service
    * Usually used for default field values for syncable services
    */
   public bool $hasExtraOptions = false;
   public static bool $hasExtraOptions = false;
   public bool $hasBatchCreate = false;
   public bool $hasBatchUpdate = false;
   public bool $hasBatchDelete = false;
@@ -89,10 +82,12 @@
    */
   protected array $syncUsers = [];
   /**
    * @var array Integration's specific content types. Set by child classes' setContentTypes
    * @var array Integration's specific content types. An array of [ TYPE => [$fields] ] Set by child classes' setContentTypes
    */
   protected array $contentTypes = [];
   protected array $credentials;
   /**
    * Check if integration is properly configured
@@ -104,7 +99,10 @@
   public function loadCredentials():array
   {
      return Auth::getInstance()->getCredentials($this->service_name, $this->userID);
      if (!isset($this->credentials)) {
         $this->credentials = Auth::getInstance()->getCredentials($this->service_name, $this->userID);
      }
      return $this->credentials;
   }
   protected function logError(string $method, string $message, array $context = []):void
@@ -143,13 +141,11 @@
      if (!is_null($this->userID)) {
         $key .= '_'.$this->userID;
      }
      if ($this->hasRequests && !isset($this->requestLimiter) && !is_null($this->oauthLimiter)) {
         $this->requestLimiter = new RateLimits($key);
      if (method_exists($this, 'initializeRequestLimiter')) {
         $this->initializeRequestLimiter();
      }
      if ($this->hasOAuth && !isset($this->oauthLimiter) && !is_null($this->oauthLimiter)) {
         $key .= '_oauth';
         $this->oauthLimiter = new RateLimits($key, ['s' => 1,'m' => 10, 'h' => 100]);
      if (method_exists($this, 'initializeOAuthRateLimiter')) {
         $this->initializeOAuthRateLimiter();
      }
   }
@@ -164,4 +160,14 @@
      }
      return $response;
   }
   public function getAllowedContent():array
   {
      return array_keys($this->contentTypes);
   }
   public function getServiceName():string
   {
      return $this->service_name;
   }
}