MediaWiki master
MediaWiki\Settings\Config\ConfigBuilder Interface Reference

Builder for Config objects. More...

Inherited by MediaWiki\Settings\Config\ConfigBuilderBase.

Public Member Functions

 build ()
 Build the resulting Config object.
 
 get (string $key)
 Get the current value for $key.
 
 set (string $key, $value, MergeStrategy $mergeStrategy=null)
 Set the configuration $key to $value.
 
 setDefault (string $key, $defaultValue, MergeStrategy $mergeStrategy=null)
 Set the default for the configuration $key to $defaultValue.
 
 setMulti (array $values, array $mergeStrategies=[])
 Set all values in the array.
 
 setMultiDefault (array $defaults, array $mergeStrategies)
 Set defaults in a batch.
 

Detailed Description

Builder for Config objects.

Stability: unstable

Definition at line 13 of file ConfigBuilder.php.

Member Function Documentation

◆ build()

MediaWiki\Settings\Config\ConfigBuilder::build ( )

Build the resulting Config object.

Returns
Config

Implemented in MediaWiki\Settings\Config\ArrayConfigBuilder, and MediaWiki\Settings\Config\GlobalConfigBuilder.

◆ get()

MediaWiki\Settings\Config\ConfigBuilder::get ( string  $key)

Get the current value for $key.

Parameters
string$key
Returns
mixed

Implemented in MediaWiki\Settings\Config\ArrayConfigBuilder, and MediaWiki\Settings\Config\GlobalConfigBuilder.

◆ set()

MediaWiki\Settings\Config\ConfigBuilder::set ( string  $key,
  $value,
MergeStrategy  $mergeStrategy = null 
)

Set the configuration $key to $value.

Parameters
string$key
mixed$value
MergeStrategy | null$mergeStrategystrategy for merging array config values.
Returns
ConfigBuilder

Implemented in MediaWiki\Settings\Config\ConfigBuilderBase.

◆ setDefault()

MediaWiki\Settings\Config\ConfigBuilder::setDefault ( string  $key,
  $defaultValue,
MergeStrategy  $mergeStrategy = null 
)

Set the default for the configuration $key to $defaultValue.

If the $key is already set, non-array $defaultValue will be ignored, for array $defaultValue the existing value will be merged into it as if the default was already there when the existing value was set.

Parameters
string$key
mixed$defaultValue
MergeStrategy | null$mergeStrategystrategy for merging array config values.
Returns
ConfigBuilder

Implemented in MediaWiki\Settings\Config\ConfigBuilderBase.

◆ setMulti()

MediaWiki\Settings\Config\ConfigBuilder::setMulti ( array  $values,
array  $mergeStrategies = [] 
)

Set all values in the array.

Parameters
array$values
MergeStrategy[]$mergeStrategiesThe merge strategies indexed by config key
Returns
ConfigBuilder

Implemented in MediaWiki\Settings\Config\ArrayConfigBuilder, MediaWiki\Settings\Config\ConfigBuilderBase, and MediaWiki\Settings\Config\GlobalConfigBuilder.

◆ setMultiDefault()

MediaWiki\Settings\Config\ConfigBuilder::setMultiDefault ( array  $defaults,
array  $mergeStrategies 
)

Set defaults in a batch.

Parameters
array$defaultsThe default values
MergeStrategy[]$mergeStrategiesThe merge strategies indexed by config key
Returns
ConfigBuilder
Exceptions
SettingsBuilderExceptionif a merge strategy is not provided and the value is not an array.

Implemented in MediaWiki\Settings\Config\ConfigBuilderBase.


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