summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-22 01:35:59 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-22 01:35:59 +0200
commit78d3e2164116f299effb11d25b1971e6d375366e (patch)
treed7a875f96833946b82f001ebdba1c23b19d32b17 /utility
parentfb28fadcf6e71b4b797aa4241436ec3add543ba0 (diff)
get rid of simplepie
Diffstat (limited to 'utility')
-rw-r--r--utility/picofeedclientfactory.php40
-rw-r--r--utility/simplepieapifactory.php53
2 files changed, 40 insertions, 53 deletions
diff --git a/utility/picofeedclientfactory.php b/utility/picofeedclientfactory.php
new file mode 100644
index 000000000..527d0e13c
--- /dev/null
+++ b/utility/picofeedclientfactory.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Alessandro Cosentino 2012
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+
+namespace OCA\News\Utility;
+
+use \PicoFeed\Config;
+use \PicoFeed\Client;
+
+class PicoFeedClientFactory {
+
+ private $config;
+
+ public function __construct(Config $config) {
+ $this->config = $config;
+ }
+
+
+ /**
+ * Returns a new instance of an PicoFeed Http client
+ * @return \PicoFeed\Client instance
+ */
+ public function build() {
+ $client = Client::getInstance();
+ $client->setConfig($this->config);
+ return $client;
+ }
+
+
+} \ No newline at end of file
diff --git a/utility/simplepieapifactory.php b/utility/simplepieapifactory.php
deleted file mode 100644
index 92cbe18f3..000000000
--- a/utility/simplepieapifactory.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-
-namespace OCA\News\Utility;
-
-
-class SimplePieAPIFactory {
-
- /**
- * Builds a simplepie file object. This is needed because
- * the file object contains logic in its constructor which makes it
- * impossible to inject and test
- *
- * @param $url
- * @param int $timeout
- * @param int $redirects
- * @param string $headers
- * @param string $useragent
- * @param bool $force_fsockopen
- * @return \SimplePie_File a new object
- */
- public function getFile($url, $timeout=10, $redirects=5, $headers=null,
- $useragent=null, $force_fsockopen=false) {
-
- return new \SimplePie_File($url, $timeout, $redirects, $headers,
- $useragent, $force_fsockopen);
- }
-
-
- /**
- * Returns a new instance of a SimplePie_Core() object. This is needed
- * because the class relies on external dependencies which are not passed
- * in via the constructor and thus making it nearly impossible to unit test
- * code that uses this class
- * @return \SimplePie_Core instance
- */
- public function getCore() {
- return new \SimplePie();
- }
-
-
-} \ No newline at end of file