- md5
- d331597cc7ecb98d401dc75f45fcd237
- sha1
- 1f2d176571a96e626c892d5e32a74b2bf72b064a
- sha256
- ec6f815e68e2f73f99adc9b7987e8e88e249c28fcf67318af1b22d326cf66564
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
<?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\Categories\CategoryFactoryInterface;
use Joomla\CMS\Component\Router\RouterFactoryInterface;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* Service provider for the service router factory.
*
* @since 4.0.0
*/
class RouterFactory implements ServiceProviderInterface
{
/**
* The module namespace
*
* @var string
*
* @since 4.0.0
*/
private $namespace;
/**
* DispatcherFactory 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(
RouterFactoryInterface::class,
function (Container $container) {
$categoryFactory = null;
if ($container->has(CategoryFactoryInterface::class)) {
$categoryFactory = $container->get(CategoryFactoryInterface::class);
}
return new \Joomla\CMS\Component\Router\RouterFactory(
$this->namespace,
$categoryFactory,
$container->get(DatabaseInterface::class)
);
}
);
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.