Back to ModuleDispatcherFactory class

Method createDispatcher

public \Joomla\CMS\Dispatcher\DispatcherInterface
createDispatcher
(\stdClass $module, \Joomla\CMS\Application\CMSApplicationInterface $application, \Joomla\Input\Input $input = null)
Creates a dispatcher.
Parameters
  • \stdClass $module The module
  • \Joomla\CMS\Application\CMSApplicationInterface $application The application
  • \Joomla\Input\Input $input The input object, defaults to the one in the application
Returns
  • \Joomla\CMS\Dispatcher\DispatcherInterface
Since
  • 4.0.0

Method createDispatcher - Source code

/**
 * 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);
}