fibable/lib/ItemParser.php

22 lines
520 B
PHP
Raw Normal View History

2025-02-13 10:37:29 +01:00
<?php
final class ItemParser
{
public static function parse(Post $post, string $link): Item
{
$item = new Item();
$item->title = $post->title;
$item->description = $post->content;
$item->pub_date = date("r", $post->date);
$item->url = $link .
"/?view=single&amp;date=" . date("Y-m-d", $post->date) .
"&amp;ref=" . $post->id;
foreach ($post->tags as $tag) {
$item->categories[] = $tag;
}
return $item;
}
}