2024-03-02 04:44:33 +03:00
|
|
|
<?php
|
|
|
|
|
2024-03-03 00:21:51 +03:00
|
|
|
use Joomla\CMS\Component\Router\RouterFactoryInterface;
|
|
|
|
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
|
|
|
use Joomla\CMS\Extension\ComponentInterface;
|
|
|
|
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
|
|
|
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
|
|
|
use Joomla\CMS\Extension\Service\Provider\RouterFactory;
|
|
|
|
use Joomla\CMS\HTML\Registry;
|
|
|
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
|
|
|
use Joomla\DI\Container;
|
2024-03-02 04:44:33 +03:00
|
|
|
use Joomla\DI\ServiceProviderInterface;
|
2024-03-03 00:21:51 +03:00
|
|
|
use Webmasterskaya\Component\OauthServer\Administrator\Extension\Component;
|
2024-03-02 04:44:33 +03:00
|
|
|
|
|
|
|
\defined('_JEXEC') or die;
|
|
|
|
|
2024-03-04 03:18:44 +03:00
|
|
|
require_once JPATH_LIBRARIES . '/lib_oauthserver/vendor/autoload.php';
|
|
|
|
|
2024-03-02 04:44:33 +03:00
|
|
|
return new class implements ServiceProviderInterface {
|
|
|
|
|
2024-03-03 00:21:51 +03:00
|
|
|
public function register(Container $container): void
|
2024-03-02 04:44:33 +03:00
|
|
|
{
|
2024-03-03 00:21:51 +03:00
|
|
|
$container->registerServiceProvider(new MVCFactory('\\Webmasterskaya\\Component\\OauthServer'));
|
|
|
|
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Webmasterskaya\\Component\\OauthServer'));
|
|
|
|
$container->registerServiceProvider(new RouterFactory('\\Webmasterskaya\\Component\\OauthServer'));
|
|
|
|
|
|
|
|
$container->set(
|
|
|
|
ComponentInterface::class,
|
|
|
|
function (Container $container) {
|
|
|
|
$component = new Component($container->get(ComponentDispatcherFactoryInterface::class));
|
|
|
|
|
|
|
|
$component->setRegistry($container->get(Registry::class));
|
|
|
|
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
|
|
|
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
|
|
|
|
|
|
|
return $component;
|
|
|
|
}
|
|
|
|
);
|
2024-03-02 04:44:33 +03:00
|
|
|
}
|
|
|
|
};
|