| Current Path : /var/www/html/administrator/components/com_jchat/services/ |
| Current File : /var/www/html/administrator/components/com_jchat/services/provider.php |
<?php
/**
* Service provider of the component application
*
* @package JCHAT::administrator::components::com_jchat
* @author Joomla! Extensions Store
* @copyright (C) 2024 - Joomla! Extensions Store
* @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Component\Router\RouterFactoryInterface;
use JExtstore\Component\JChat\Administrator\Extension\JChatComponent;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Extension\Service\Provider\RouterFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
if(!class_exists('JExtstore\Component\JChat\Administrator\Extension\JChatComponent') && function_exists('opcache_reset')){
opcache_reset();
Factory::getApplication()->redirect('index.php?option=com_jchat');
}
/**
* The extension service provider.
*/
return new class implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container
* The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container) {
$container->registerServiceProvider ( new MVCFactory ( '\\JExtstore\\Component\\JChat' ) );
$container->registerServiceProvider ( new ComponentDispatcherFactory ( '\\JExtstore\\Component\\JChat' ) );
$container->registerServiceProvider ( new RouterFactory('\\JExtstore\\Component\\JChat'));
$container->set ( ComponentInterface::class, static function (Container $container) {
$component = new JChatComponent ($container->get(ComponentDispatcherFactoryInterface::class));
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
return $component;
} );
}
};