rss-bridge/formats/PlaintextFormat.php
Dag f421c45b21
test: add feed item test (#3709)
* test: add feed item test

also some refactor

* yup

* yup
2023-09-25 22:32:15 +02:00

19 lines
492 B
PHP

<?php
class PlaintextFormat extends FormatAbstract
{
const MIME_TYPE = 'text/plain';
public function stringify()
{
$data = [];
foreach ($this->getItems() as $item) {
$data[] = $item->toArray();
}
$text = print_r($data, true);
// Remove invalid non-UTF8 characters
ini_set('mbstring.substitute_character', 'none');
$text = mb_convert_encoding($text, $this->getCharset(), 'UTF-8');
return $text;
}
}