Jake Vanderwerf
2026-09-18 a6413da67a4579866f0fd0323ddb23a7b6b9654a
inc/integrations/_Base.php
@@ -1,6 +1,7 @@
<?php
namespace JVBase\integrations;
use JVBase\inc\managers\ErrorHelper;
use JVBase\managers\Cache;
use JVBase\managers\Errors;
use JVBase\managers\IconsManager;
@@ -10,6 +11,7 @@
}
trait _Base {
   use ErrorHelper;
   /**
    * @var string Unique identifier for this service (ex: square, facebook)
    */
@@ -95,7 +97,16 @@
    */
   public function isSetUp(): bool
   {
      return !empty($this->loadCredentials());
      $tmp = null;
      if ($this->userID) {
         $tmp = $this->userID;
         $this->switchUser();
      }
      $isSetUp = !empty($this->loadCredentials()??[]);
      if ($tmp) {
         $this->switchUser($tmp);
      }
      return $isSetUp;
   }
   public function loadCredentials():array
@@ -108,8 +119,16 @@
   protected function logError(string $method, string $message, array $context = []):void
   {
      $context['service'] = $this->service_name;
      Errors::getInstance()->log('['.self::class.']'.$method, $message, $context);
      Errors::log($message, array_merge(
         [
            'service'   => $this->service_name,
            'method' => $method,
            'class'     => static::class,
         ],
         $context
      ));
   }
   protected function getReturnURL():string
@@ -131,7 +150,7 @@
   {
      if (is_admin()) {
         $icons = IconsManager::for('admin');
         return $icons->getRawSvg($icon);
         return $icons->getRawSvg($icon)??'';
      }
      return jvbDashIcon($icon);
   }