[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Extension/Service/Provider/ -> Module.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Extension\Service\Provider;
  11  
  12  use Joomla\CMS\Dispatcher\ModuleDispatcherFactoryInterface;
  13  use Joomla\CMS\Extension\ModuleInterface;
  14  use Joomla\CMS\Helper\HelperFactoryInterface;
  15  use Joomla\DI\Container;
  16  use Joomla\DI\ServiceProviderInterface;
  17  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('JPATH_PLATFORM') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * Service provider for the service based modules.
  24   *
  25   * @since  4.0.0
  26   */
  27  class Module implements ServiceProviderInterface
  28  {
  29      /**
  30       * Registers the service provider with a DI container.
  31       *
  32       * @param   Container  $container  The DI container.
  33       *
  34       * @return  void
  35       *
  36       * @since   4.0.0
  37       */
  38      public function register(Container $container)
  39      {
  40          $container->set(
  41              ModuleInterface::class,
  42              function (Container $container) {
  43                  return new \Joomla\CMS\Extension\Module(
  44                      $container->get(ModuleDispatcherFactoryInterface::class),
  45                      $container->get(HelperFactoryInterface::class)
  46                  );
  47              }
  48          );
  49      }
  50  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer