MediaWiki  1.23.14
ApiModuleManager Class Reference

This class holds a list of modules and handles instantiation. More...

Inheritance diagram for ApiModuleManager:
Collaboration diagram for ApiModuleManager:

Public Member Functions

 __construct (ApiBase $parentModule)
 Construct new module manager. More...
 
 addModule ( $name, $group, $class)
 Add or overwrite a module in this ApiMain instance. More...
 
 addModules (array $modules, $group)
 Add a list of modules to the manager. More...
 
 getGroups ()
 Get a list of groups this manager contains. More...
 
 getModule ( $moduleName, $group=null, $ignoreCache=false)
 Get module instance by name, or instantiate it if it does not exist. More...
 
 getModuleGroup ( $moduleName)
 Returns the group name for the given module. More...
 
 getNames ( $group=null)
 Get an array of modules in a specific group or all if no group is set. More...
 
 getNamesWithClasses ( $group=null)
 Create an array of (moduleName => moduleClass) for a specific group or for all. More...
 
 isDefined ( $moduleName, $group=null)
 Returns true if the specific module is defined at all or in a specific group. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 Get the Config object. More...
 
 getContext ()
 Get the RequestContext object. More...
 
 getLang ()
 Get the Language object. More...
 
 getLanguage ()
 Get the Language object. More...
 
 getOutput ()
 Get the OutputPage object. More...
 
 getRequest ()
 Get the WebRequest object. More...
 
 getSkin ()
 Get the Skin object. More...
 
 getTitle ()
 Get the Title object. More...
 
 getUser ()
 Get the User object. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ()
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 Set the IContextSource object. More...
 

Private Attributes

 $mGroups = array()
 
 $mInstances = array()
 
 $mModules = array()
 
 $mParent
 

Detailed Description

This class holds a list of modules and handles instantiation.

Since
1.21

Definition at line 34 of file ApiModuleManager.php.

Constructor & Destructor Documentation

◆ __construct()

ApiModuleManager::__construct ( ApiBase  $parentModule)

Construct new module manager.

Parameters
ApiBase$parentModuleParent module instance will be used during instantiation

Definition at line 45 of file ApiModuleManager.php.

Member Function Documentation

◆ addModule()

ApiModuleManager::addModule (   $name,
  $group,
  $class 
)

Add or overwrite a module in this ApiMain instance.

Intended for use by extending classes who wish to add their own modules to their lexicon or override the behavior of inherent ones.

Parameters
string$groupName of the module group
string$nameThe identifier for this module.
string$classThe class where this module is implemented.

Definition at line 69 of file ApiModuleManager.php.

References $name, and array().

Referenced by addModules().

◆ addModules()

ApiModuleManager::addModules ( array  $modules,
  $group 
)

Add a list of modules to the manager.

Parameters
array$modulesA map of ModuleName => ModuleClass
string$groupWhich group modules belong to (action,format,...)

Definition at line 54 of file ApiModuleManager.php.

References $name, addModule(), and as.

◆ getGroups()

ApiModuleManager::getGroups ( )

Get a list of groups this manager contains.

Returns
array

Definition at line 171 of file ApiModuleManager.php.

◆ getModule()

ApiModuleManager::getModule (   $moduleName,
  $group = null,
  $ignoreCache = false 
)

Get module instance by name, or instantiate it if it does not exist.

Parameters
string$moduleNamemodule name
string$groupoptionally validate that the module is in a specific group
bool$ignoreCacheif true, force-creates a new instance and does not cache it
Returns
mixed the new module instance, or null if failed

Definition at line 81 of file ApiModuleManager.php.

◆ getModuleGroup()

ApiModuleManager::getModuleGroup (   $moduleName)

Returns the group name for the given module.

Parameters
string$moduleName
Returns
string group name or null if missing

Definition at line 159 of file ApiModuleManager.php.

◆ getNames()

ApiModuleManager::getNames (   $group = null)

Get an array of modules in a specific group or all if no group is set.

Parameters
string$groupoptional group filter
Returns
array list of module names

Definition at line 110 of file ApiModuleManager.php.

References $name, array(), and as.

◆ getNamesWithClasses()

ApiModuleManager::getNamesWithClasses (   $group = null)

Create an array of (moduleName => moduleClass) for a specific group or for all.

Parameters
string$groupname of the group to get or null for all
Returns
array name=>class map

Definition at line 129 of file ApiModuleManager.php.

References $name, array(), and as.

◆ isDefined()

ApiModuleManager::isDefined (   $moduleName,
  $group = null 
)

Returns true if the specific module is defined at all or in a specific group.

Parameters
string$moduleNamemodule name
string$groupgroup name to check against, or null to check all groups,
Returns
boolean true if defined

Definition at line 146 of file ApiModuleManager.php.

Member Data Documentation

◆ $mGroups

ApiModuleManager::$mGroups = array()
private

Definition at line 38 of file ApiModuleManager.php.

◆ $mInstances

ApiModuleManager::$mInstances = array()
private

Definition at line 37 of file ApiModuleManager.php.

◆ $mModules

ApiModuleManager::$mModules = array()
private

Definition at line 39 of file ApiModuleManager.php.

◆ $mParent

ApiModuleManager::$mParent
private

Definition at line 36 of file ApiModuleManager.php.


The documentation for this class was generated from the following file: