| 1 | <?php |
| 2 | namespace MediaWiki\Settings\Config; |
| 3 | |
| 4 | use MediaWiki\Settings\SettingsBuilderException; |
| 5 | |
| 6 | /** |
| 7 | * Represents a config schema. |
| 8 | * |
| 9 | * @since 1.39 |
| 10 | */ |
| 11 | interface ConfigSchema { |
| 12 | |
| 13 | /** |
| 14 | * Get a list of all defined keys |
| 15 | * |
| 16 | * @return string[] |
| 17 | */ |
| 18 | public function getDefinedKeys(): array; |
| 19 | |
| 20 | /** |
| 21 | * Check whether schema for $key is defined. |
| 22 | * |
| 23 | * @param string $key |
| 24 | * |
| 25 | * @return bool |
| 26 | */ |
| 27 | public function hasSchemaFor( string $key ): bool; |
| 28 | |
| 29 | /** |
| 30 | * Get all defined default values. |
| 31 | * |
| 32 | * @return array<string,mixed> An associative array mapping setting names |
| 33 | * to their respective default values. |
| 34 | */ |
| 35 | public function getDefaults(): array; |
| 36 | |
| 37 | /** |
| 38 | * Get all dynamic default declarations. |
| 39 | * @see DynamicDefaultValues. |
| 40 | * |
| 41 | * @return array<string,array> |
| 42 | */ |
| 43 | public function getDynamicDefaults(): array; |
| 44 | |
| 45 | /** |
| 46 | * Check if the $key has a default value set in the schema. |
| 47 | * |
| 48 | * @param string $key |
| 49 | * |
| 50 | * @return bool |
| 51 | */ |
| 52 | public function hasDefaultFor( string $key ): bool; |
| 53 | |
| 54 | /** |
| 55 | * Get the default value for the $key. |
| 56 | * For keys that do not define a default, null is assumed. |
| 57 | * |
| 58 | * @param string $key |
| 59 | * |
| 60 | * @return mixed |
| 61 | */ |
| 62 | public function getDefaultFor( string $key ); |
| 63 | |
| 64 | /** |
| 65 | * Get the merge strategy defined for the $key, or null if none defined. |
| 66 | * |
| 67 | * @param string $key |
| 68 | * |
| 69 | * @return MergeStrategy|null |
| 70 | * @throws SettingsBuilderException if merge strategy name is invalid. |
| 71 | */ |
| 72 | public function getMergeStrategyFor( string $key ): ?MergeStrategy; |
| 73 | } |