[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/api-authentication/basic/services/ -> provider.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Apiauthentication.basic
   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') or die;
  12  
  13  use Joomla\CMS\Extension\PluginInterface;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\Plugin\PluginHelper;
  16  use Joomla\CMS\User\UserFactoryInterface;
  17  use Joomla\Database\DatabaseInterface;
  18  use Joomla\DI\Container;
  19  use Joomla\DI\ServiceProviderInterface;
  20  use Joomla\Event\DispatcherInterface;
  21  use Joomla\Plugin\ApiAuthentication\Basic\Extension\Basic;
  22  
  23  return new class implements ServiceProviderInterface
  24  {
  25      /**
  26       * Registers the service provider with a DI container.
  27       *
  28       * @param   Container  $container  The DI container.
  29       *
  30       * @return  void
  31       *
  32       * @since   4.2.0
  33       */
  34      public function register(Container $container)
  35      {
  36          $container->set(
  37              PluginInterface::class,
  38              function (Container $container) {
  39                  $plugin = new Basic(
  40                      $container->get(DispatcherInterface::class),
  41                      (array) PluginHelper::getPlugin('api-authentication', 'basic'),
  42                      $container->get(UserFactoryInterface::class)
  43                  );
  44                  $plugin->setApplication(Factory::getApplication());
  45                  $plugin->setDatabase($container->get(DatabaseInterface::class));
  46  
  47                  return $plugin;
  48              }
  49          );
  50      }
  51  };


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