| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Settings\Source\Format; |
| 4 | |
| 5 | use Stringable; |
| 6 | use UnexpectedValueException; |
| 7 | |
| 8 | /** |
| 9 | * A SettingsFormat is meant to detect supported file types and/or decode |
| 10 | * source contents into settings arrays. |
| 11 | * |
| 12 | * @since 1.38 |
| 13 | * @stable to implement |
| 14 | */ |
| 15 | interface SettingsFormat extends Stringable { |
| 16 | /** |
| 17 | * Decodes the given settings data and returns an associative array. |
| 18 | * |
| 19 | * @param string $data Settings data. |
| 20 | * |
| 21 | * @return array |
| 22 | * @throws UnexpectedValueException |
| 23 | */ |
| 24 | public function decode( string $data ): array; |
| 25 | |
| 26 | /** |
| 27 | * Whether or not the format claims to support a file with the given |
| 28 | * extension. |
| 29 | * |
| 30 | * @param string $ext File extension. |
| 31 | * |
| 32 | * @return bool |
| 33 | */ |
| 34 | public static function supportsFileExtension( string $ext ): bool; |
| 35 | } |