CoreFiles by mySites.guru
provider.php46 lines, 1,305 bytes, from Joomla_5.2.2-Stable-Full_Package.zip
Raw History Compare with 5.2.1
md5
9fd357a78477a5d35175d0120a2379e9
sha1
58d0d550e07d07dd0c6d548d4933667c0c7c4d25
sha256
1cd98da227966e4e14ee28467b73276c9b08cef04512d7b330db377342e17edb
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  System.languagecode
 *
 * @copyright   (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\System\LanguageCode\Extension\LanguageCode;

return new class () implements ServiceProviderInterface {
    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   4.4.0
     */
    public function register(Container $container): void
    {
        $container->set(
            PluginInterface::class,
            function (Container $container) {
                $plugin     = new LanguageCode(
                    $container->get(DispatcherInterface::class),
                    (array) PluginHelper::getPlugin('system', 'languagecode')
                );
                $plugin->setApplication(Factory::getApplication());

                return $plugin;
            }
        );
    }
};

The same content is in 54 releases, Joomla 5.0.0-rc to 5.3.0-alpha3. See them all, or every version of this file.