diff --git a/CHANGELOG.md b/CHANGELOG.md index 2576e0eb1..a727c20a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#new) * Added `Uri::method()` to get current HTTP method (GET/POST etc) + * Added `FormatterInterface::getSupportedFileExtensions()` method, deprecated `getFileExtension()` # v1.5.0-rc.1 ## 07/31/2018 diff --git a/system/src/Grav/Framework/File/Formatter/FormatterInterface.php b/system/src/Grav/Framework/File/Formatter/FormatterInterface.php index 84af00b63..35ceccfde 100644 --- a/system/src/Grav/Framework/File/Formatter/FormatterInterface.php +++ b/system/src/Grav/Framework/File/Formatter/FormatterInterface.php @@ -11,11 +11,11 @@ namespace Grav\Framework\File\Formatter; interface FormatterInterface { /** - * Get file extension with dot. + * Get file extensions supported by current formatter (with dot). * - * @return string + * @return string[] */ - public function getFileExtension(); + public function getSupportedFileExtensions(); /** * Encode data into a string. diff --git a/system/src/Grav/Framework/File/Formatter/IniFormatter.php b/system/src/Grav/Framework/File/Formatter/IniFormatter.php index e7ad2833c..15d67c4e2 100644 --- a/system/src/Grav/Framework/File/Formatter/IniFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/IniFormatter.php @@ -25,11 +25,20 @@ class IniFormatter implements FormatterInterface } /** - * {@inheritdoc} + * @deprecated + * @internal */ public function getFileExtension() { - return $this->config['file_extension']; + return $this->getSupportedFileExtensions()[0]; + } + + /** + * {@inheritdoc} + */ + public function getSupportedFileExtensions() + { + return (array) $this->config['file_extension']; } /** diff --git a/system/src/Grav/Framework/File/Formatter/JsonFormatter.php b/system/src/Grav/Framework/File/Formatter/JsonFormatter.php index 12c245016..bd01b8307 100644 --- a/system/src/Grav/Framework/File/Formatter/JsonFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/JsonFormatter.php @@ -23,11 +23,20 @@ class JsonFormatter implements FormatterInterface } /** - * {@inheritdoc} + * @deprecated + * @internal */ public function getFileExtension() { - return $this->config['file_extension']; + return $this->getSupportedFileExtensions()[0]; + } + + /** + * {@inheritdoc} + */ + public function getSupportedFileExtensions() + { + return (array) $this->config['file_extension']; } /** diff --git a/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php b/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php index 7269c2fe7..c38f691f1 100644 --- a/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php @@ -29,11 +29,20 @@ class MarkdownFormatter implements FormatterInterface } /** - * {@inheritdoc} + * @deprecated + * @internal */ public function getFileExtension() { - return $this->config['file_extension']; + return $this->getSupportedFileExtensions()[0]; + } + + /** + * {@inheritdoc} + */ + public function getSupportedFileExtensions() + { + return (array) $this->config['file_extension']; } /** diff --git a/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php b/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php index 3c581efa5..95744104c 100644 --- a/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php @@ -25,11 +25,20 @@ class SerializeFormatter implements FormatterInterface } /** - * {@inheritdoc} + * @deprecated + * @internal */ public function getFileExtension() { - return $this->config['file_extension']; + return $this->getSupportedFileExtensions()[0]; + } + + /** + * {@inheritdoc} + */ + public function getSupportedFileExtensions() + { + return (array) $this->config['file_extension']; } /** diff --git a/system/src/Grav/Framework/File/Formatter/YamlFormatter.php b/system/src/Grav/Framework/File/Formatter/YamlFormatter.php index 9a5d60278..ee18061ea 100644 --- a/system/src/Grav/Framework/File/Formatter/YamlFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/YamlFormatter.php @@ -30,11 +30,20 @@ class YamlFormatter implements FormatterInterface } /** - * {@inheritdoc} + * @deprecated + * @internal */ public function getFileExtension() { - return $this->config['file_extension']; + return $this->getSupportedFileExtensions()[0]; + } + + /** + * {@inheritdoc} + */ + public function getSupportedFileExtensions() + { + return (array) $this->config['file_extension']; } /**