diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-02 11:09:33 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-02 11:09:33 +0200 |
commit | 3350ed7cafa93873a6c0520e2bf0d9c05219adae (patch) | |
tree | b9ae909ad68e6595285159a906eb3102f7c8739b /dependencyinjection | |
parent | 45d81beb6cc66e720e2983fc29d1a0a82d8bf9c1 (diff) |
added pluggable fetchers
Diffstat (limited to 'dependencyinjection')
-rw-r--r-- | dependencyinjection/dicontainer.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/dependencyinjection/dicontainer.php b/dependencyinjection/dicontainer.php index 4350ac276..6cedc42c5 100644 --- a/dependencyinjection/dicontainer.php +++ b/dependencyinjection/dicontainer.php @@ -43,6 +43,7 @@ use OCA\News\Db\FeedMapper; use OCA\News\Db\ItemMapper; use OCA\News\Db\StatusFlag; +use OCA\News\Utility\Fetcher; use OCA\News\Utility\FeedFetcher; require_once __DIR__ . '/../3rdparty/SimplePie/autoloader.php'; @@ -90,14 +91,14 @@ class DIContainer extends BaseContainer { }); /** - * Business + * Business Layer */ $this['FolderBl'] = $this->share(function($c){ return new FolderBl($c['FolderMapper']); }); $this['FeedBl'] = $this->share(function($c){ - return new FeedBl($c['FeedMapper'], $c['FeedFetcher'], + return new FeedBl($c['FeedMapper'], $c['Fetcher'], $c['ItemMapper'], $c['API']); }); @@ -125,6 +126,16 @@ class DIContainer extends BaseContainer { /** * Utility */ + $this['Fetcher'] = $this->share(function(){ + $fetcher = new Fetcher(); + + // register fetchers in order + // the most generic fetcher should be the last one + $fetcher->registerFetcher($c['FeedFetcher']); + + return $fetcher; + }); + $this['FeedFetcher'] = $this->share(function($c){ return new FeedFetcher($c['API']); }); |