mirror of
https://github.com/getgrav/grav.git
synced 2026-03-16 01:21:07 +01:00
Added FormatterInterface::getDefaultFileExtension()
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
1. [](#new)
|
||||
* Added `Uri::method()` to get current HTTP method (GET/POST etc)
|
||||
* Added `FormatterInterface::getSupportedFileExtensions()` method, deprecated `getFileExtension()`
|
||||
* `FormatterInterface`: Added `getSupportedFileExtensions()` and `getDefaultFileExtension()` methods
|
||||
|
||||
# v1.5.0-rc.1
|
||||
## 07/31/2018
|
||||
|
||||
@@ -10,6 +10,15 @@ namespace Grav\Framework\File\Formatter;
|
||||
|
||||
interface FormatterInterface
|
||||
{
|
||||
/**
|
||||
* Get default file extension from current formatter (with dot).
|
||||
*
|
||||
* Default file extension is the first defined extension.
|
||||
*
|
||||
* @return string File extension (can be empty).
|
||||
*/
|
||||
public function getDefaultFileExtension();
|
||||
|
||||
/**
|
||||
* Get file extensions supported by current formatter (with dot).
|
||||
*
|
||||
|
||||
@@ -25,12 +25,21 @@ class IniFormatter implements FormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
* @deprecated 1.5 Use $formatter->getDefaultFileExtension() instead.
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
return $this->getSupportedFileExtensions()[0];
|
||||
return $this->getDefaultFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFileExtension()
|
||||
{
|
||||
$extensions = $this->getSupportedFileExtensions();
|
||||
|
||||
return (string) reset($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,21 @@ class JsonFormatter implements FormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
* @deprecated 1.5 Use $formatter->getDefaultFileExtension() instead.
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
return $this->getSupportedFileExtensions()[0];
|
||||
return $this->getDefaultFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFileExtension()
|
||||
{
|
||||
$extensions = $this->getSupportedFileExtensions();
|
||||
|
||||
return (string) reset($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,12 +29,21 @@ class MarkdownFormatter implements FormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
* @deprecated 1.5 Use $formatter->getDefaultFileExtension() instead.
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
return $this->getSupportedFileExtensions()[0];
|
||||
return $this->getDefaultFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFileExtension()
|
||||
{
|
||||
$extensions = $this->getSupportedFileExtensions();
|
||||
|
||||
return (string) reset($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,12 +25,21 @@ class SerializeFormatter implements FormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
* @deprecated 1.5 Use $formatter->getDefaultFileExtension() instead.
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
return $this->getSupportedFileExtensions()[0];
|
||||
return $this->getDefaultFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFileExtension()
|
||||
{
|
||||
$extensions = $this->getSupportedFileExtensions();
|
||||
|
||||
return (string) reset($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,12 +30,21 @@ class YamlFormatter implements FormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
* @deprecated 1.5 Use $formatter->getDefaultFileExtension() instead.
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
return $this->getSupportedFileExtensions()[0];
|
||||
return $this->getDefaultFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFileExtension()
|
||||
{
|
||||
$extensions = $this->getSupportedFileExtensions();
|
||||
|
||||
return (string) reset($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user