summaryrefslogtreecommitdiffstats
path: root/utility/fetcher.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-02 11:09:33 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-02 11:09:33 +0200
commit3350ed7cafa93873a6c0520e2bf0d9c05219adae (patch)
treeb9ae909ad68e6595285159a906eb3102f7c8739b /utility/fetcher.php
parent45d81beb6cc66e720e2983fc29d1a0a82d8bf9c1 (diff)
added pluggable fetchers
Diffstat (limited to 'utility/fetcher.php')
-rw-r--r--utility/fetcher.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/utility/fetcher.php b/utility/fetcher.php
new file mode 100644
index 000000000..c834de5e4
--- /dev/null
+++ b/utility/fetcher.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Utility;
+
+
+class Fetcher {
+
+ private $fetchers;
+
+ public function __construct(){
+ $this->fetchers = array();
+ }
+
+
+ public function registerFetcher(IFeedFetcher $fetcher){
+ array_push($this->fetchers, $fetcher);
+ }
+
+
+ public function fetch($url){
+ foreach($this->fetchers as $fetcher){
+ if($fetcher->canHandle($url)){
+ return $fetcher->fetch($url);
+ }
+ }
+ }
+
+
+} \ No newline at end of file