summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-09 00:56:48 +0200
committeremkael <emkael@tlen.pl>2019-07-09 00:56:48 +0200
commitd00e448b7e8a6a724100bc8b15907fa9c6f241e3 (patch)
treebc1da134a7914984def5cf21dd072ad9a195a1e3
parent5c10dbc4ce05e1e9c8dc2343f12b7d2dd3492b93 (diff)
Github commit history as a source provider
-rw-r--r--providers/Github.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/providers/Github.php b/providers/Github.php
new file mode 100644
index 0000000..f8fb3dc
--- /dev/null
+++ b/providers/Github.php
@@ -0,0 +1,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';
+ }
+
+}
+
+?>