MediaWiki master
|
Aggregates multiple config schemas. More...
Inherits MediaWiki\Settings\Config\ConfigSchema.
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. | |
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.
MediaWiki\Settings\Config\ConfigSchemaAggregator::addDefaults | ( | array | $defaults, |
string | $sourceName = 'unknown' ) |
Declare default values.
array | $defaults | |
string | $sourceName |
Definition at line 145 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::addDynamicDefaults | ( | array | $dynamicDefaults, |
string | $sourceName = 'unknown' ) |
Declare dynamic defaults.
array | $dynamicDefaults | |
string | $sourceName |
Definition at line 185 of file ConfigSchemaAggregator.php.
References $dynamicDefaults.
MediaWiki\Settings\Config\ConfigSchemaAggregator::addMergeStrategies | ( | array | $mergeStrategies, |
string | $sourceName = 'unknown' ) |
Declare merge strategies.
array | $mergeStrategies | |
string | $sourceName |
Definition at line 165 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::addSchema | ( | string | $key, |
array | $schema, | ||
string | $sourceName = 'unknown' ) |
Add a config schema to the aggregator.
string | $key | |
array | $schema | |
string | $sourceName |
Definition at line 52 of file ConfigSchemaAggregator.php.
Referenced by MediaWiki\Settings\Config\ConfigSchemaAggregator\addSchemaMulti().
MediaWiki\Settings\Config\ConfigSchemaAggregator::addSchemaMulti | ( | array | $schemas | ) |
Add multiple schema definitions.
array[] | $schemas | An associative array mapping config variable names to their respective schemas. |
Definition at line 107 of file ConfigSchemaAggregator.php.
References MediaWiki\Settings\Config\ConfigSchemaAggregator\addSchema().
MediaWiki\Settings\Config\ConfigSchemaAggregator::addTypes | ( | array | $types, |
string | $sourceName = 'unknown' ) |
Declare types.
array | $types | |
string | $sourceName |
Definition at line 155 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefaultFor | ( | string | $key | ) |
Get default value for the $key.
If no default value was declared, this returns null.
string | $key |
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 308 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefaults | ( | ) |
Get all defined default values.
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 259 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getDefinedKeys | ( | ) |
Get a list of all defined keys.
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 199 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getDynamicDefaultDeclarationFor | ( | string | $key | ) |
Get a dynamic default declaration for $key.
If no dynamic default is declared, this returns null.
string | $key |
Definition at line 329 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getDynamicDefaults | ( | ) |
Get all dynamic default declarations.
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 287 of file ConfigSchemaAggregator.php.
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.
Definition at line 353 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getMergeStrategyFor | ( | string | $key | ) |
Get the merge strategy defined for the $key, or null if none defined.
string | $key |
SettingsBuilderException | if merge strategy name is invalid. |
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 340 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getMergeStrategyNames | ( | ) |
Get the names of all known merge strategies.
Definition at line 277 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getSchemaFor | ( | string | $key | ) |
Get the schema for the given key.
string | $key |
Definition at line 218 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getTypeFor | ( | string | $key | ) |
Get type for the $key, or null if the type is not known.
string | $key |
Definition at line 318 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::getTypes | ( | ) |
Get all known types.
Definition at line 268 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::hasDefaultFor | ( | string | $key | ) |
Check if the $key has a default values set in the schema.
string | $key |
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 297 of file ConfigSchemaAggregator.php.
MediaWiki\Settings\Config\ConfigSchemaAggregator::hasSchemaFor | ( | string | $key | ) |
Check whether schema for $key is defined.
string | $key |
Implements MediaWiki\Settings\Config\ConfigSchema.
Definition at line 246 of file ConfigSchemaAggregator.php.
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.
Config | $config |
Definition at line 430 of file ConfigSchemaAggregator.php.
References StatusValue\fatal(), MediaWiki\Config\Config\get(), and MediaWiki\Config\Config\has().
MediaWiki\Settings\Config\ConfigSchemaAggregator::validateValue | ( | string | $key, |
$value ) |
Check if the given value conforms to the relevant schema.
string | $key | |
mixed | $value |
Definition at line 454 of file ConfigSchemaAggregator.php.