Added FormatterInterface::getSupportedFileExtensions() method, deprecated getFileExtension()

This commit is contained in:
Matias Griese
2018-08-03 13:03:51 +03:00
parent 76fb11366b
commit ca3cf2ea3c
7 changed files with 59 additions and 13 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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'];
}
/**

View File

@@ -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'];
}
/**

View File

@@ -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'];
}
/**

View File

@@ -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'];
}
/**

View File

@@ -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'];
}
/**