MediaWiki master
MediaWiki\Config\ConfigFactory Class Reference

Factory class to create Config objects. More...

Inherits SalvageableService.

Collaboration diagram for MediaWiki\Config\ConfigFactory:

Public Member Functions

 getConfigNames ()
 makeConfig ( $name)
 Create a given Config using the registered callback for $name.
 register ( $name, $callback)
 Register a new config factory function.
 salvage (SalvageableService $other)
 Re-uses existing Cache objects from $other.

Protected Attributes

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

Detailed Description

Factory class to create Config objects.


Definition at line 36 of file ConfigFactory.php.

Member Function Documentation

◆ getConfigNames()

MediaWiki\Config\ConfigFactory::getConfigNames ( )

Definition at line 90 of file ConfigFactory.php.

◆ makeConfig()

MediaWiki\Config\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.

string$nameName of the extension/component you want a Config object for 'main' is used for core
ConfigExceptionIf a factory function isn't registered for $name
UnexpectedValueExceptionIf the factory function returns a non-Config object

Definition at line 126 of file ConfigFactory.php.

◆ register()

MediaWiki\Config\ConfigFactory::register ( $name,
$callback )

Register a new config factory function.

Will override if it's already registered. Use "*" for $name to provide a fallback config for all unknown names.

callable | Config$callbackA factory callback that takes this ConfigFactory as an argument and returns a Config instance, or an existing Config instance.
InvalidArgumentExceptionIf an invalid callback is provided

Definition at line 103 of file ConfigFactory.php.

◆ salvage()

MediaWiki\Config\ConfigFactory::salvage ( SalvageableService $other)

Re-uses existing Cache objects from $other.

Cache objects are only re-used if the registered factory function for both is the same. Cache config is not copied, and only instances of caches defined on this instance with the same config are copied.

See also
SalvageableService$otherThe object to salvage state from. $other must have the exact same type as $this.

Definition at line 62 of file ConfigFactory.php.

Member Data Documentation

◆ $configs

array MediaWiki\Config\ConfigFactory::$configs = []

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

Definition at line 49 of file ConfigFactory.php.

◆ $factoryFunctions

array MediaWiki\Config\ConfigFactory::$factoryFunctions = []

Map of config name => callback.

Definition at line 42 of file ConfigFactory.php.

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