CoreFiles by mySites.guru
ComponentDispatcherFactory.php67 lines, 1,640 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
69b3b844f010a8801060f4ff88160bf2
sha1
497e7b232a813ae85bdd2ab133a537372244e590
sha256
f3d07dc47e90dc5c0ca09e7acefcd624db7e8d1cf1596a289532a1cf1e9c57af
<?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\Extension\Service\Provider;

use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
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 service dispatcher factory.
 *
 * @since  4.0.0
 */
class ComponentDispatcherFactory implements ServiceProviderInterface
{
    /**
     * The component namespace
     *
     * @var  string
     *
     * @since   4.0.0
     */
    private $namespace;

    /**
     * ComponentDispatcherFactory constructor.
     *
     * @param   string  $namespace  The namespace
     *
     * @since   4.0.0
     */
    public function __construct(string $namespace)
    {
        $this->namespace = $namespace;
    }

    /**
     * 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->set(
            ComponentDispatcherFactoryInterface::class,
            function (Container $container) {
                return new \Joomla\CMS\Dispatcher\ComponentDispatcherFactory($this->namespace, $container->get(MVCFactoryInterface::class));
            }
        );
    }
}

The same content is in 70 releases, Joomla 4.2.1 to 4.4.14. See them all, or every version of this file.