mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-09-01 08:15:57 +02:00
Add BarejsonFormat
This commit is contained in:
parent
1c3024fca7
commit
0e4830e0ed
1 changed files with 17 additions and 0 deletions
17
formats/BarejsonFormat.php
Normal file
17
formats/BarejsonFormat.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
class BarejsonFormat extends FormatAbstract
|
||||
{
|
||||
const MIME_TYPE = 'application/json';
|
||||
|
||||
public function stringify()
|
||||
{
|
||||
if (count($this->getItems()) != 1) {
|
||||
throw new Exception('Unable to identify the target');
|
||||
}
|
||||
$item = $this->getItems()[0];
|
||||
$content = $item->getContent() ?? '';
|
||||
$content = mb_convert_encoding($content, $this->getCharset(), 'UTF-8');
|
||||
return $content;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue