2021-11-11 18:46:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MediaWiki\Settings\Source\Format;
|
|
|
|
|
|
|
|
|
|
use Stringable;
|
|
|
|
|
use UnexpectedValueException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A SettingsFormat is meant to detect supported file types and/or decode
|
|
|
|
|
* source contents into settings arrays.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.38
|
|
|
|
|
* @todo mark as stable before the 1.38 release
|
|
|
|
|
*/
|
|
|
|
|
interface SettingsFormat extends Stringable {
|
|
|
|
|
/**
|
|
|
|
|
* Decodes the given settings data and returns an associative array.
|
|
|
|
|
*
|
|
|
|
|
* @param string $data Settings data.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
* @throws UnexpectedValueException
|
|
|
|
|
*/
|
|
|
|
|
public function decode( string $data ): array;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether or not the format claims to support a file with the given
|
|
|
|
|
* extension.
|
|
|
|
|
*
|
|
|
|
|
* @param string $ext File extension.
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2021-11-19 01:09:48 +00:00
|
|
|
public static function supportsFileExtension( string $ext ): bool;
|
2021-11-11 18:46:32 +00:00
|
|
|
}
|