_JEXEC & copyright

This commit is contained in:
Artem Vasilev 2024-03-09 17:03:55 +03:00
parent 0cce4012be
commit 9a4ff028f4

View File

@ -1,22 +1,36 @@
<?php <?php
/**
* @package Joomla.Administrator
* @subpackage com_oauthserver
*
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
* @license MIT; see LICENSE.txt
**/
namespace Webmasterskaya\Component\OauthServer\Administrator\Helper; namespace Webmasterskaya\Component\OauthServer\Administrator\Helper;
\defined('_JEXEC') or die;
abstract class ComponentHelper abstract class ComponentHelper
{ {
/**
* Creates a Composer autoloader, unregisters it, and registers it again at the end of the autoloader stack.
*
* @return void
* @since version
*/
public static function registerComponentDependencies(): void public static function registerComponentDependencies(): void
{ {
static $registered; static $registered;
if (!isset($registered)) { if (!isset($registered))
{
/** @var \Composer\Autoload\ClassLoader $loader */ /** @var \Composer\Autoload\ClassLoader $loader */
$loader = require JPATH_ADMINISTRATOR . '/components/com_oauthserver/vendor/autoload.php'; $loader = require JPATH_ADMINISTRATOR . '/components/com_oauthserver/vendor/autoload.php';
$loader->unregister(); $loader->unregister();
if (spl_autoload_register([new \Joomla\CMS\Autoload\ClassLoader($loader), 'loadClass'])) { $loader->register();
$registered = true;
}
} }
} }
} }