Перенёс загрузку библиотек в component boot

This commit is contained in:
Artem Vasilev 2024-03-08 02:43:10 +03:00
parent fa0a116d5c
commit 5b258d4164
2 changed files with 15 additions and 2 deletions

View File

@ -14,8 +14,6 @@ use Webmasterskaya\Component\OauthServer\Administrator\Extension\Component;
\defined('_JEXEC') or die; \defined('_JEXEC') or die;
require_once JPATH_LIBRARIES . '/lib_oauthserver/vendor/autoload.php';
return new class implements ServiceProviderInterface { return new class implements ServiceProviderInterface {
public function register(Container $container): void public function register(Container $container): void

View File

@ -32,5 +32,20 @@ class Component extends MVCComponent implements
*/ */
public function boot(ContainerInterface $container): void 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);
}
} }
} }