[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/multifactorauth/email/services/ -> provider.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Multifactorauth.email
   6   *
   7   * @copyright   (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') || die;
  12  
  13  use Joomla\CMS\Extension\PluginInterface;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\Plugin\PluginHelper;
  16  use Joomla\DI\Container;
  17  use Joomla\DI\ServiceProviderInterface;
  18  use Joomla\Event\DispatcherInterface;
  19  use Joomla\Plugin\Multifactorauth\Email\Extension\Email;
  20  
  21  return new class implements ServiceProviderInterface
  22  {
  23      /**
  24       * Registers the service provider with a DI container.
  25       *
  26       * @param   Container  $container  The DI container.
  27       *
  28       * @return  void
  29       *
  30       * @since 4.2.0
  31       */
  32      public function register(Container $container)
  33      {
  34          $container->set(
  35              PluginInterface::class,
  36              function (Container $container) {
  37                  $config  = (array) PluginHelper::getPlugin('multifactorauth', 'email');
  38                  $subject = $container->get(DispatcherInterface::class);
  39  
  40                  $plugin = new Email($subject, $config);
  41                  $plugin->setApplication(Factory::getApplication());
  42  
  43                  return $plugin;
  44              }
  45          );
  46      }
  47  };


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