summaryrefslogtreecommitdiff
path: root/providers/Beer.php
blob: b6f11a905d3dbed9f2cafeb953394db38d5c6fb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace Providers;

require_once('Facebook.php');

class Beer extends \Providers\Facebook {

    protected $_feedGroup;

    public function __construct($feed, $options=[]) {
        parent::__construct($feed, $options);
        $this->_feedGroup = $feed;
        $this->_groupConfig = json_decode(file_get_contents('../config/beer.json'), TRUE);
    }

    protected function _getCachePath() {
        return '../cache/beer.%s';
    }

    protected function _fetchItems() {
        $data = [];
        foreach ($this->_groupConfig[$this->_feedGroup] as $feed) {
            $this->_feed = $feed;
            $data = array_merge($data, parent::_fetchItems());
        }
        return $data;
    }

    protected function _sortContent($content) {
        usort($content, function($c1, $c2) { return $c2->Time - $c1->Time; });
        return $content;
    }

}

?>