find('div.beer-item') as $div) {
$details = $div->find('div.beer-details, div.details');
if ($details) {
$texts = [
$details->find('p.name')->text(),
$details->find('p.style')->text(),
$details->find('p.desc')->eq(1)->text(),
$details->find('p.abv')->text(),
$details->find('p.ibu')->text()
];
$items[] = [
'id' => $div->attr()['data-bid'],
'link' => $div->find('a.label')->attr()['href'],
'name' => $texts[0],
'texts' => $texts,
'time' => trim($details->find('p.date')->text())
];
}
}
return array_values($items);
}
protected function _mapItems($content) {
return array_map(
function ($obj) {
$item = new Item();
$item->ID = $obj['id'];
$item->Link = sprintf('https://untappd.com/%s', $obj['link']);
$item->Title = sprintf('New beer by %s: %s', $this->_feed, $obj['name']);
$item->Text = implode('
', $obj['texts']);
$item->Time = strtotime(str_replace('Added ', '', $obj['time']) . ' 00:00:00');
return $item;
},
$content
);
}
public function title() {
return sprintf("%s's untappd beer list", $this->_feed);
}
}
?>