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.

23 lines
340 B

  1. <?php
  2. namespace FeedWriter\View;
  3. class JSON {
  4. public $require = ['date', 'author'];
  5. protected $_struct = [];
  6. public function collect ($item)
  7. {
  8. $this->_struct[] = [
  9. 'date' => $item->date,
  10. 'author' => $item->author
  11. ];
  12. }
  13. public function generateFeed ()
  14. {
  15. return json_encode($this->_struct);
  16. }
  17. }