- md5
- ce2022a9b5018c4dde8232e6836e4859
- sha1
- af7c33fb74c8c762e60d43fed230b2cd6c9957ea
- sha256
- 40798dda8cba8c3a1d806601a234583c0c9a4755d076bcbbe882d2b0586901a0
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
<?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\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.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.