diff --git a/com_oauthserver/administrator/src/Extension/Component.php b/com_oauthserver/administrator/src/Extension/Component.php index d2c119a..cd83844 100644 --- a/com_oauthserver/administrator/src/Extension/Component.php +++ b/com_oauthserver/administrator/src/Extension/Component.php @@ -10,6 +10,7 @@ use Joomla\CMS\Extension\BootableExtensionInterface; use Joomla\CMS\Extension\MVCComponent; use Joomla\CMS\HTML\HTMLRegistryAwareTrait; use Psr\Container\ContainerInterface; +use Webmasterskaya\Component\OauthServer\Administrator\Helper\ComponentHelper; \defined('JPATH_PLATFORM') or die; @@ -32,22 +33,6 @@ class Component extends MVCComponent implements */ public function boot(ContainerInterface $container): void { - self::requireDependency(); - } - - public static function requireDependency(): void - { - static $required; - - if (!isset($required)) { - /** @var \Composer\Autoload\ClassLoader $loader */ - $loader = require JPATH_LIBRARIES . '/lib_oauthserver/vendor/autoload.php'; - - $loader->unregister(); - - spl_autoload_register([new \Joomla\CMS\Autoload\ClassLoader($loader), 'loadClass'], true, true); - - $required = true; - } + ComponentHelper::registerComponentDependencies(); } } \ No newline at end of file diff --git a/com_oauthserver/administrator/src/Helper/ComponentHelper.php b/com_oauthserver/administrator/src/Helper/ComponentHelper.php new file mode 100644 index 0000000..40ff66f --- /dev/null +++ b/com_oauthserver/administrator/src/Helper/ComponentHelper.php @@ -0,0 +1,22 @@ +unregister(); + + if (spl_autoload_register([new \Joomla\CMS\Autoload\ClassLoader($loader), 'loadClass'])) { + $registered = true; + } + } + } +} \ No newline at end of file