mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 09:35:57 +02:00
formats: Add getMimeType() function (#1299)
Allows getting the expected MIME type of the format's output. A corresponding MIME_TYPE constant is also defined in FormatAbstract for the format implementations to overwrite.
This commit is contained in:
parent
d1e4bd7285
commit
c8d5c85c76
7 changed files with 30 additions and 5 deletions
|
@ -21,6 +21,9 @@ abstract class FormatAbstract implements FormatInterface {
|
|||
/** The default charset (UTF-8) */
|
||||
const DEFAULT_CHARSET = 'UTF-8';
|
||||
|
||||
/** MIME type of format output */
|
||||
const MIME_TYPE = 'text/plain';
|
||||
|
||||
/** @var string|null $contentType The content type */
|
||||
protected $contentType = null;
|
||||
|
||||
|
@ -39,6 +42,11 @@ abstract class FormatAbstract implements FormatInterface {
|
|||
/** @var array $extraInfos The extra infos */
|
||||
protected $extraInfos;
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getMimeType(){
|
||||
return static::MIME_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
|
|
@ -66,6 +66,13 @@ interface FormatInterface {
|
|||
*/
|
||||
public function getExtraInfos();
|
||||
|
||||
/**
|
||||
* Return MIME type
|
||||
*
|
||||
* @return string The MIME type
|
||||
*/
|
||||
public function getMimeType();
|
||||
|
||||
/**
|
||||
* Set charset
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue