[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

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


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