CoreFiles by mySites.guru
Toolbar.php52 lines, 1,434 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
1b6544c3aefa50a6537998aba6ec89fa
sha1
186677d7f1b8c2bf919d68d886a649fe8b16bc9c
sha256
258aada3cdb15428d5c37d59b9a01ae1da527f038931ab3b74deb71d9e1b92d2
<?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('JPATH_PLATFORM') 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 70 releases, Joomla 4.2.1 to 4.4.14. See them all, or every version of this file.