[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Extension; 11 12 use Joomla\CMS\Application\CMSApplicationInterface; 13 use Joomla\CMS\Dispatcher\DispatcherInterface; 14 use Joomla\CMS\Dispatcher\ModuleDispatcherFactoryInterface; 15 use Joomla\CMS\Helper\HelperFactoryAwareInterface; 16 use Joomla\CMS\Helper\HelperFactoryInterface; 17 use Joomla\Input\Input; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('JPATH_PLATFORM') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * Access to module specific services. 25 * 26 * @since 4.0.0 27 */ 28 class Module implements ModuleInterface, HelperFactoryInterface 29 { 30 /** 31 * The dispatcher factory. 32 * 33 * @var ModuleDispatcherFactoryInterface 34 * 35 * @since 4.0.0 36 */ 37 private $dispatcherFactory; 38 39 /** 40 * The helper factory. 41 * 42 * @var HelperFactoryInterface 43 * 44 * @since 4.0.0 45 */ 46 private $helperFactory; 47 48 /** 49 * Module constructor. 50 * 51 * @param ModuleDispatcherFactoryInterface $dispatcherFactory The dispatcher factory 52 * @param HelperFactoryInterface $helperFactory The helper factory 53 * 54 * @since 4.0.0 55 */ 56 public function __construct(ModuleDispatcherFactoryInterface $dispatcherFactory, HelperFactoryInterface $helperFactory) 57 { 58 $this->dispatcherFactory = $dispatcherFactory; 59 $this->helperFactory = $helperFactory; 60 } 61 62 /** 63 * Returns the dispatcher for the given application, module and input. 64 * 65 * @param \stdClass $module The module 66 * @param CMSApplicationInterface $application The application 67 * @param Input $input The input object, defaults to the one in the application 68 * 69 * @return DispatcherInterface 70 * 71 * @since 4.0.0 72 */ 73 public function getDispatcher(\stdClass $module, CMSApplicationInterface $application, Input $input = null): DispatcherInterface 74 { 75 $dispatcher = $this->dispatcherFactory->createDispatcher($module, $application, $input); 76 77 if ($dispatcher instanceof HelperFactoryAwareInterface) { 78 $dispatcher->setHelperFactory($this->helperFactory); 79 } 80 81 return $dispatcher; 82 } 83 84 /** 85 * Returns a helper instance for the given name. 86 * 87 * @param string $name The name 88 * @param array $config The config 89 * 90 * @return \stdClass 91 * 92 * @since 4.0.0 93 */ 94 public function getHelper(string $name, array $config = []) 95 { 96 return $this->helperFactory->getHelper($name, $config); 97 } 98 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |