MediaWiki REL1_31
|
Factory class to create Config objects. More...
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. | |
Static Public Member Functions | |
static | getDefaultInstance () |
Protected Attributes | |
array | $configs = [] |
Config objects that have already been created name => Config object. | |
array | $factoryFunctions = [] |
Map of config name => callback. | |
ConfigFactory::getConfigNames | ( | ) |
Definition at line 93 of file ConfigFactory.php.
|
static |
Definition at line 51 of file ConfigFactory.php.
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 | $name | Name of the extension/component you want a Config object for 'main' is used for core |
ConfigException | If a factory function isn't registered for $name |
UnexpectedValueException | If the factory function returns a non-Config object |
Definition at line 129 of file ConfigFactory.php.
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.
string | $name | |
callable | Config | $callback | A factory callback that takes this ConfigFactory as an argument and returns a Config instance, or an existing Config instance. |
InvalidArgumentException | If an invalid callback is provided |
Definition at line 106 of file ConfigFactory.php.
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.
SalvageableService | $other | The object to salvage state from. $other must have the exact same type as $this. |
Implements MediaWiki\Services\SalvageableService.
Definition at line 66 of file ConfigFactory.php.
References $name.
|
protected |
Config objects that have already been created name => Config object.
Definition at line 44 of file ConfigFactory.php.
|
protected |
Map of config name => callback.
Definition at line 37 of file ConfigFactory.php.