- md5
- 63061a92d50bc50364a0dc59c363edfb
- sha1
- 0af0c5be8e352c4d82fa03a5963477022a67fe54
- sha256
- 2759eee0b9d88e63f74f33558fe48227beec7ec99da004440c30938645ac1954
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\CMS\Dispatcher;
defined('_JEXEC') or die;
use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\Input\Input;
/**
* Namespace based implementation of the ModuleDispatcherFactoryInterface
*
* @since 4.0.0
*/
class ModuleDispatcherFactory implements ModuleDispatcherFactoryInterface
{
/**
* The extension namespace
*
* @var string
*
* @since 4.0.0
*/
private $namespace;
/**
* ModuleDispatcherFactory constructor.
*
* @param string $namespace The namespace
*
* @since 4.0.0
*/
public function __construct(string $namespace)
{
$this->namespace = $namespace;
}
/**
* Creates a dispatcher.
*
* @param \stdClass $module The module
* @param CMSApplicationInterface $application The application
* @param Input $input The input object, defaults to the one in the application
*
* @return DispatcherInterface
*
* @since 4.0.0
*/
public function createDispatcher(\stdClass $module, CMSApplicationInterface $application, Input $input = null): DispatcherInterface
{
$name = 'Site';
if ($application->isClient('administrator'))
{
$name = 'Administrator';
}
$className = '\\' . trim($this->namespace, '\\') . '\\' . $name . '\\Dispatcher\\Dispatcher';
if (!class_exists($className))
{
$className = ModuleDispatcher::class;
}
return new $className($module, $application, $input ?: $application->input);
}
}
The same content is in 5 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha11. See them all, or every version of this file.