aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Settings/Source/Format/SettingsFormat.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Settings/Source/Format/SettingsFormat.php')
-rw-r--r--includes/Settings/Source/Format/SettingsFormat.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/Settings/Source/Format/SettingsFormat.php b/includes/Settings/Source/Format/SettingsFormat.php
new file mode 100644
index 000000000000..943faa88d544
--- /dev/null
+++ b/includes/Settings/Source/Format/SettingsFormat.php
@@ -0,0 +1,35 @@
+<?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
+ */
+ public function supportsFileExtension( string $ext ): bool;
+}