CoreFiles by mySites.guru
Dispatcher.php49 lines, 1,327 bytes, from Joomla_5.1.2-Stable-Full_Package.zip
Raw History Compare with 5.1.1
md5
6d6058d127b1d0f494aa289d808c5fcf
sha1
45bcd662f250ff27eb4b0abf9f92aee49a2fc9ed
sha256
6f0931a6309ac7487b7344bdc447e3105dd0cbe5cb024d61ff9e9dd49d403977
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright   (C) 2018 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\Event\Dispatcher as EventDispatcher;
use Joomla\Event\DispatcherInterface as EventDispatcherInterface;

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

/**
 * Service provider for the application's event dispatcher dependency
 *
 * @since  4.0.0
 */
class Dispatcher 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('dispatcher', EventDispatcherInterface::class)
            ->alias(EventDispatcher::class, EventDispatcherInterface::class)
            ->share(
                EventDispatcherInterface::class,
                function (Container $container) {
                    return new EventDispatcher();
                },
                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.