CoreFiles by mySites.guru
Input.php50 lines, 1,417 bytes, from Joomla_6.0.2-Stable-Full_Package.zip
Raw History Compare with 6.0.1
md5
9611f198ed9a3c718586bd3a5a9fba91
sha1
8e759159e1aa25fa3428ccd7b999e35385f9c2cb
sha256
368ac884f8e7dc3385db100811d1fd2acba4a8b92aa963bb97624fea72a82e3e
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright   (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Service\Provider;

use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Input\Input as CMSInput;

/**
 * Service provider for the the Joomla Input object.
 *
 * Whilst generally speaking it's an anti-pattern for the request object to be in a DIC, in the case of Joomla whilst
 * there, both the web application class and session class have a hard dependency on the input object, as a result it's
 * required that this exists in the DIC for now. Strategically there should be a long term plan to remove this from the
 * DIC.
 *
 * @note It is strongly recommended that extensions get the input object from the application and DO NOT use this
 * service container.
 *
 * @since  5.0.0
 */
class Input implements ServiceProviderInterface
{
    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   5.0.0
     */
    public function register(Container $container)
    {
        $container->share(
            CMSInput::class,
            function () {
                return new CMSInput();
            },
            true
        );
    }
}

The same content is in 50 releases, Joomla 6.0.0-alpha1 to 6.2.1-rc1. See them all, or every version of this file.