CoreFiles by mySites.guru
ModuleDispatcherFactory.php64 lines, 1,321 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
ab748d18b96935214eda9e7bfe1ea273
sha1
6452e034280f318432b68c2fba60027a5a4d09a6
sha256
03d1a78aedb05104d079e364bc78162e76e085a6e3ec4713e06333550ab0d284
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Extension\Service\Provider;

\defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Dispatcher\ModuleDispatcherFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
 * Service provider for the service dispatcher factory.
 *
 * @since  4.0.0
 */
class ModuleDispatcherFactory implements ServiceProviderInterface
{
	/**
	 * The module 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(
			ModuleDispatcherFactoryInterface::class,
			function (Container $container)
			{
				return new \Joomla\CMS\Dispatcher\ModuleDispatcherFactory($this->namespace);
			}
		);
	}
}

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.