- md5
- d20ec6be0703c8a4ae238bdfa27955c8
- sha1
- 8929a6ecf9f6220fc9ba25547e44fc7d765a53ad
- sha256
- 7fd9c3bf9932d9500991a85bd25c26e5a22ea1130325fb1e160beb838dbabe60
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 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;
use Joomla\CMS\MVC\Factory\MVCFactoryFactoryInterface;
/**
* Namesapce based implementation of the DispatcherFactoryInterface
*
* @since 4.0.0
*/
class DispatcherFactory implements DispatcherFactoryInterface
{
/**
* The extension namespace
*
* @var string
*
* @since 4.0.0
*/
protected $namespace;
/**
* The MVC factory
*
* @var MVCFactoryFactoryInterface
*
* @since 4.0.0
*/
private $mvcFactoryFactory;
/**
* DispatcherFactory constructor.
*
* @param string $namespace The namespace
* @param MVCFactoryFactoryInterface $mvcFactoryFactory The MVC factory
*
* @since 4.0.0
*/
public function __construct(string $namespace, MVCFactoryFactoryInterface $mvcFactoryFactory)
{
$this->namespace = $namespace;
$this->mvcFactoryFactory = $mvcFactoryFactory;
}
/**
* Creates a dispatcher.
*
* @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(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 = '\\Joomla\\CMS\\Dispatcher\\Dispatcher';
}
return new $className($application, $input ?: $application->input, $this->mvcFactoryFactory);
}
}
No other release has this exact content. See every version of this file.