summaryrefslogtreecommitdiff
path: root/providers/Github.php
blob: f8fb3dcdc57c6cdb0cc085052a301caa0c1a1ea5 (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
<?php

namespace Providers;

require_once('Rss.php');

class Github extends \Providers\Rss {

    public function __construct($feed, $options=[]) {
        if (!count($options)) {
            throw new Exception('Invalid URL for GitHub proxy');
        }
        $feed .= '---' . key(array_splice($options, 0, 1));
        parent::__construct($feed, $options);
    }

    protected function _getFeedUrl($feed) {
        return sprintf('https://github.com/%s/commits/master.atom', str_replace('---', '/', $feed));
    }

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

}

?>