PHP Universal Feed Generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
380 B

  1. <?php
  2. namespace FeedWriter\View;
  3. use \SparkLib\CSV as SparkCSV;
  4. class CSV {
  5. public function __construct ()
  6. {
  7. $this->_csv = new SparkCSV();
  8. $this->_csv->addHeader(['date', 'author']);
  9. }
  10. public function collect ($item)
  11. {
  12. $this->_csv->addRow([$item->date, $item->author]);
  13. }
  14. public function generateFeed ()
  15. {
  16. return $this->_csv->render();
  17. }
  18. }