MediaWiki master
MediaWiki\Settings\Config\ConfigSchemaAggregator Class Reference

Aggregates multiple config schemas. More...

Inherits MediaWiki\Settings\Config\ConfigSchema.

Collaboration diagram for MediaWiki\Settings\Config\ConfigSchemaAggregator:

Public Member Functions

 addDefaults (array $defaults, string $sourceName='unknown')
 Declare default values.
 
 addDynamicDefaults (array $dynamicDefaults, string $sourceName='unknown')
 Declare dynamic defaults.
 
 addMergeStrategies (array $mergeStrategies, string $sourceName='unknown')
 Declare merge strategies.
 
 addSchema (string $key, array $schema, string $sourceName='unknown')
 Add a config schema to the aggregator.
 
 addSchemaMulti (array $schemas)
 Add multiple schema definitions.
 
 addTypes (array $types, string $sourceName='unknown')
 Declare types.
 
 getDefaultFor (string $key)
 Get default value for the $key.
 
 getDefaults ()
 Get all defined default values.
 
 getDefinedKeys ()
 Get a list of all defined keys.
 
 getDynamicDefaultDeclarationFor (string $key)
 Get a dynamic default declaration for $key.
 
 getDynamicDefaults ()
 Get all dynamic default declarations.
 
 getMergeStrategies ()
 Get all merge strategies indexed by config key.
 
 getMergeStrategyFor (string $key)
 Get the merge strategy defined for the $key, or null if none defined.
 
 getMergeStrategyNames ()
 Get the names of all known merge strategies.
 
 getSchemaFor (string $key)
 Get the schema for the given key.
 
 getTypeFor (string $key)
 Get type for the $key, or null if the type is not known.
 
 getTypes ()
 Get all known types.
 
 hasDefaultFor (string $key)
 Check if the $key has a default values set in the schema.
 
 hasSchemaFor (string $key)
 Check whether schema for $key is defined.
 
 validateConfig (Config $config)
 Check if the given config conforms to the schema.
 
 validateValue (string $key, $value)
 Check if the given value conforms to the relevant schema.
 

Detailed Description

Aggregates multiple config schemas.

Some aspects of the schema are maintained separately, to optimized for settings defaults, types and merge strategies in bulk, and later accessing them independently of each other, for each config key.

Definition at line 21 of file ConfigSchemaAggregator.php.

Member Function Documentation

◆ addDefaults()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addDefaults ( array $defaults,
string $sourceName = 'unknown' )

Declare default values.

Parameters
array$defaults
string$sourceName

Definition at line 145 of file ConfigSchemaAggregator.php.

◆ addDynamicDefaults()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addDynamicDefaults ( array $dynamicDefaults,
string $sourceName = 'unknown' )

Declare dynamic defaults.

See also
DynamicDefaultValues.
Parameters
array$dynamicDefaults
string$sourceName

Definition at line 185 of file ConfigSchemaAggregator.php.

References $dynamicDefaults.

◆ addMergeStrategies()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addMergeStrategies ( array $mergeStrategies,
string $sourceName = 'unknown' )

Declare merge strategies.

Parameters
array$mergeStrategies
string$sourceName

Definition at line 165 of file ConfigSchemaAggregator.php.

◆ addSchema()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addSchema ( string $key,
array $schema,
string $sourceName = 'unknown' )

Add a config schema to the aggregator.

Parameters
string$key
array$schema
string$sourceName

Definition at line 52 of file ConfigSchemaAggregator.php.

Referenced by MediaWiki\Settings\Config\ConfigSchemaAggregator\addSchemaMulti().

◆ addSchemaMulti()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addSchemaMulti ( array $schemas)

Add multiple schema definitions.

See also
addSchema()
Parameters
array[]$schemasAn associative array mapping config variable names to their respective schemas.

Definition at line 107 of file ConfigSchemaAggregator.php.

References MediaWiki\Settings\Config\ConfigSchemaAggregator\addSchema().

◆ addTypes()

MediaWiki\Settings\Config\ConfigSchemaAggregator::addTypes ( array $types,
string $sourceName = 'unknown' )

Declare types.

Parameters
array$types
string$sourceName

Definition at line 155 of file ConfigSchemaAggregator.php.

◆ getDefaultFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefaultFor ( string $key)

Get default value for the $key.

If no default value was declared, this returns null.

Parameters
string$key
Returns
mixed

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 308 of file ConfigSchemaAggregator.php.

◆ getDefaults()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefaults ( )

Get all defined default values.

Returns
array

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 259 of file ConfigSchemaAggregator.php.

◆ getDefinedKeys()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefinedKeys ( )

Get a list of all defined keys.

Returns
string[]

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 199 of file ConfigSchemaAggregator.php.

◆ getDynamicDefaultDeclarationFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getDynamicDefaultDeclarationFor ( string $key)

Get a dynamic default declaration for $key.

If no dynamic default is declared, this returns null.

Parameters
string$key
Returns
?array An associative array of the form expected by DynamicDefaultValues.

Definition at line 329 of file ConfigSchemaAggregator.php.

◆ getDynamicDefaults()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getDynamicDefaults ( )

Get all dynamic default declarations.

See also
DynamicDefaultValues.
Returns
array<string,array>

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 287 of file ConfigSchemaAggregator.php.

◆ getMergeStrategies()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getMergeStrategies ( )

Get all merge strategies indexed by config key.

If there is no merge strategy for a given key, the element will be absent.

Returns
MergeStrategy[]

Definition at line 353 of file ConfigSchemaAggregator.php.

◆ getMergeStrategyFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getMergeStrategyFor ( string $key)

Get the merge strategy defined for the $key, or null if none defined.

Parameters
string$key
Returns
MergeStrategy|null
Exceptions
SettingsBuilderExceptionif merge strategy name is invalid.

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 340 of file ConfigSchemaAggregator.php.

◆ getMergeStrategyNames()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getMergeStrategyNames ( )

Get the names of all known merge strategies.

Returns
array<string>

Definition at line 277 of file ConfigSchemaAggregator.php.

◆ getSchemaFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getSchemaFor ( string $key)

Get the schema for the given key.

Parameters
string$key
Returns
array

Definition at line 218 of file ConfigSchemaAggregator.php.

◆ getTypeFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getTypeFor ( string $key)

Get type for the $key, or null if the type is not known.

Parameters
string$key
Returns
mixed

Definition at line 318 of file ConfigSchemaAggregator.php.

◆ getTypes()

MediaWiki\Settings\Config\ConfigSchemaAggregator::getTypes ( )

Get all known types.

Returns
array<string|array>

Definition at line 268 of file ConfigSchemaAggregator.php.

◆ hasDefaultFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::hasDefaultFor ( string $key)

Check if the $key has a default values set in the schema.

Parameters
string$key
Returns
bool

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 297 of file ConfigSchemaAggregator.php.

◆ hasSchemaFor()

MediaWiki\Settings\Config\ConfigSchemaAggregator::hasSchemaFor ( string $key)

Check whether schema for $key is defined.

Parameters
string$key
Returns
bool

Implements MediaWiki\Settings\Config\ConfigSchema.

Definition at line 246 of file ConfigSchemaAggregator.php.

◆ validateConfig()

MediaWiki\Settings\Config\ConfigSchemaAggregator::validateConfig ( Config $config)

Check if the given config conforms to the schema.

Note that all keys for which a schema was defined are required to be present in $config.

Parameters
Config$config
Returns
StatusValue

Definition at line 430 of file ConfigSchemaAggregator.php.

References StatusValue\fatal(), MediaWiki\Config\Config\get(), and MediaWiki\Config\Config\has().

◆ validateValue()

MediaWiki\Settings\Config\ConfigSchemaAggregator::validateValue ( string $key,
$value )

Check if the given value conforms to the relevant schema.

Parameters
string$key
mixed$value
Returns
StatusValue

Definition at line 454 of file ConfigSchemaAggregator.php.


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