MediaWiki  1.23.13
ConfigFactory Class Reference

Factory class to create Config objects. More...

Public Member Functions

 makeConfig ( $name)
 Create a given Config using the registered callback for $name. More...
 
 register ( $name, $callback)
 Register a new config factory function Will override if it's already registered. More...
 

Static Public Member Functions

static getDefaultInstance ()
 

Protected Attributes

array $configs = array()
 Config objects that have already been created name => Config object. More...
 
array $factoryFunctions = array()
 Map of config name => callback. More...
 

Detailed Description

Factory class to create Config objects.

Since
1.23

Definition at line 29 of file ConfigFactory.php.

Member Function Documentation

◆ getDefaultInstance()

static ConfigFactory::getDefaultInstance ( )
static

Definition at line 42 of file ConfigFactory.php.

References $name, $self, as, and global.

Referenced by RequestContext\getConfig().

◆ makeConfig()

ConfigFactory::makeConfig (   $name)

Create a given Config using the registered callback for $name.

If an object was already created, the same Config object is returned.

Parameters
string$nameof the extension/component you want a Config object for 'main' is used for core
Exceptions
ConfigExceptionif a factory function isn't registered for $name
UnexpectedValueExceptionif the factory function returns a non-Config object
Returns
Config

Definition at line 77 of file ConfigFactory.php.

References $name.

◆ register()

ConfigFactory::register (   $name,
  $callback 
)

Register a new config factory function Will override if it's already registered.

Parameters
string$name
callable$callbackthat takes this ConfigFactory as an argument
Exceptions
InvalidArgumentExceptionif an invalid callback is provided

Definition at line 61 of file ConfigFactory.php.

References $name.

Member Data Documentation

◆ $configs

array ConfigFactory::$configs = array()
protected

Config objects that have already been created name => Config object.

Definition at line 40 of file ConfigFactory.php.

◆ $factoryFunctions

array ConfigFactory::$factoryFunctions = array()
protected

Map of config name => callback.

Definition at line 34 of file ConfigFactory.php.


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