CoreFiles by mySites.guru
Toolbar.php52 lines, 1,426 bytes, from Joomla_5.2.2-Stable-Full_Package.zip
Raw History Compare with 5.2.1
md5
0a3cbff2c262e4d11c1cb7f80d3cff1c
sha1
bba33f00e7e03e14dbaaa6ae7cc46032bc8d9f3b
sha256
e7d60b10dbc9f95c5c210a89b45a2069b1e86fb04183a0691aee3b053f43922b
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2017 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\CMS\Toolbar\ContainerAwareToolbarFactory;
use Joomla\CMS\Toolbar\ToolbarFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Service provider for the application's toolbar dependency
 *
 * @since  4.0.0
 */
class Toolbar implements ServiceProviderInterface
{
    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   4.0.0
     */
    public function register(Container $container)
    {
        $container->alias('toolbar.factory', ToolbarFactoryInterface::class)
            ->alias(ContainerAwareToolbarFactory::class, ToolbarFactoryInterface::class)
            ->share(
                ToolbarFactoryInterface::class,
                function (Container $container) {
                    $factory = new ContainerAwareToolbarFactory();
                    $factory->setContainer($container);

                    return $factory;
                },
                true
            );
    }
}

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