[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/api/ -> ApiModuleManager.php (summary)

Created on Dec 27, 2012 Copyright © 2012 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"

File Size: 293 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ApiModuleManager:: (11 methods):
  __construct()
  addModules()
  addModule()
  getModule()
  instantiateModule()
  getNames()
  getNamesWithClasses()
  getClassName()
  isDefined()
  getModuleGroup()
  getGroups()


Class: ApiModuleManager  - X-Ref

This class holds a list of modules and handles instantiation

__construct( ApiBase $parentModule )   X-Ref
Construct new module manager

param: ApiBase $parentModule Parent module instance will be used during instantiation

addModules( array $modules, $group )   X-Ref
Add a list of modules to the manager. Each module is described
by a module spec.

Each module spec is an associative array containing at least
the 'class' key for the module's class, and optionally a
'factory' key for the factory function to use for the module.

That factory function will be called with two parameters,
the parent module (an instance of ApiBase, usually ApiMain)
and the name the module was registered under. The return
value must be an instance of the class given in the 'class'
field.

For backward compatibility, the module spec may also be a
simple string containing the module's class name. In that
case, the class' constructor will be called with the parent
module and module name as parameters, as described above.

Examples for defining module specs:

param: array $modules A map of ModuleName => ModuleSpec; The ModuleSpec
param: string $group Which group modules belong to (action,format,...)

addModule( $name, $group, $class, $factory = null )   X-Ref
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.

param: string $name The identifier for this module.
param: string $group Name of the module group
param: string $class The class where this module is implemented.
param: callable|null $factory Callback for instantiating the module.

getModule( $moduleName, $group = null, $ignoreCache = false )   X-Ref
Get module instance by name, or instantiate it if it does not exist

param: string $moduleName Module name
param: string $group Optionally validate that the module is in a specific group
param: bool $ignoreCache If true, force-creates a new instance and does not cache it
return: ApiBase|null The new module instance, or null if failed

instantiateModule( $name, $class, $factory = null )   X-Ref
Instantiate the module using the given class or factory function.

param: string $name The identifier for this module.
param: string $class The class where this module is implemented.
param: callable|null $factory Callback for instantiating the module.
return: ApiBase

getNames( $group = null )   X-Ref
Get an array of modules in a specific group or all if no group is set.

param: string $group Optional group filter
return: array List of module names

getNamesWithClasses( $group = null )   X-Ref
Create an array of (moduleName => moduleClass) for a specific group or for all.

param: string $group Name of the group to get or null for all
return: array Name=>class map

getClassName( $module )   X-Ref
Returns the class name of the given module

param: string $module Module name
return: string|bool class name or false if the module does not exist

isDefined( $moduleName, $group = null )   X-Ref
Returns true if the specific module is defined at all or in a specific group.

param: string $moduleName Module name
param: string $group Group name to check against, or null to check all groups,
return: bool True if defined

getModuleGroup( $moduleName )   X-Ref
Returns the group name for the given module

param: string $moduleName
return: string Group name or null if missing

getGroups()   X-Ref
Get a list of groups this manager contains.

return: array



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1