Jacek Kowalski
2026-02-17 64b225bce5d8d66222a1311c8d201f399ca9d6b8
src/UcrmHelper.php
@@ -2,6 +2,8 @@
namespace SIPL\UCRM\wFirma;
use Ubnt\UcrmPluginSdk\Service\UcrmOptionsManager;
class UcrmHelper {
   protected string $rootDirectory;
   protected ?\Ubnt\UcrmPluginSdk\Service\UcrmApi $api = NULL;
@@ -12,7 +14,7 @@
   function __construct(?string $rootDirectory = NULL) {
      if ($rootDirectory === NULL) {
         $rootDirectory = __DIR__ . '/..';
         $rootDirectory = dirname(__DIR__);
      }
      $this->rootDirectory = $rootDirectory;
   }
@@ -28,6 +30,12 @@
      return $this->api;
   }
   function getSelfUrl(): string {
      $ucrmOptionsManager = new UcrmOptionsManager($this->rootDirectory);
      $options = $ucrmOptionsManager->loadOptions();
      return $options->ucrmLocalUrl ?? $options->ucrmPublicUrl ?? '';
   }
   function getAttributes(): UcrmAttributes {
      if ($this->attributes === NULL) {
         $this->attributes = new UcrmAttributes($this);