summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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';
+ }
+
+}
+
+?>