CoreFiles by mySites.guru
provider.php51 lines, 1,313 bytes, from Joomla_4.2.0-alpha3-dev-Development-Full_Package.zip
Raw History Compare with 4.2.0-alpha2
md5
7ec13e83df18ad708c4c0eed03de7fff
sha1
b6d00d75b97576d873b08e9db83a1845a7cebd4d
sha256
7554db73ea3fc5b8c16d0b564148d8b78dde5daaaab9a4bad6203e44b5c651ce
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Apiauthentication.token
 *
 * @copyright   (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\User\UserFactoryInterface;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Filter\InputFilter;
use Joomla\Plugin\ApiAuthentication\Token\Extension\Token;

return new class implements ServiceProviderInterface
{
	/**
	 * Registers the service provider with a DI container.
	 *
	 * @param   Container  $container  The DI container.
	 *
	 * @return  void
	 *
	 * @since   4.2.0
	 */
	public function register(Container $container)
	{
		$container->set(
			PluginInterface::class,
			function (Container $container)
			{
				$plugin = new Token(
					$container->get(DispatcherInterface::class),
					(array) PluginHelper::getPlugin('api-authentication', 'token'),
					$container->get(UserFactoryInterface::class),
					new InputFilter
				);
				$plugin->setDatabase($container->get(DatabaseInterface::class));

				return $plugin;
			}
		);
	}
};

The same content is in 2 releases, Joomla 4.2.0-alpha3 to 4.2.0-beta1. See them all, or every version of this file.