From 5fea9fc1f5014485818d0331666cb58675f89378 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 5 Aug 2018 15:53:45 +0200 Subject: [PATCH] bridges: Fix bridges failing unit test --- bridges/ContainerLinuxReleasesBridge.php | 2 +- bridges/DealabsBridge.php | 8 ++++---- bridges/ElloBridge.php | 10 +++++----- bridges/FB2Bridge.php | 3 --- bridges/FilterBridge.php | 1 + bridges/PixivBridge.php | 2 +- bridges/SupInfoBridge.php | 2 +- bridges/VkBridge.php | 2 +- bridges/YGGTorrentBridge.php | 2 +- 9 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bridges/ContainerLinuxReleasesBridge.php b/bridges/ContainerLinuxReleasesBridge.php index 06c8ac4..a82ba7e 100644 --- a/bridges/ContainerLinuxReleasesBridge.php +++ b/bridges/ContainerLinuxReleasesBridge.php @@ -26,7 +26,7 @@ class ContainerLinuxReleasesBridge extends BridgeAbstract { ] ]; - public function getReleaseFeed($jsonUrl) { + private function getReleaseFeed($jsonUrl) { $json = getContents($jsonUrl) or returnServerError('Could not request Core OS Website.'); return json_decode($json, true); diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php index 04b92ed..a10aaa9 100644 --- a/bridges/DealabsBridge.php +++ b/bridges/DealabsBridge.php @@ -157,7 +157,7 @@ class PepperBridgeAbstract extends BridgeAbstract { /** * Get the Deal data from the choosen group in the choosed order */ - public function collectDataGroup() + protected function collectDataGroup() { $group = $this->getInput('group'); @@ -171,7 +171,7 @@ class PepperBridgeAbstract extends BridgeAbstract { /** * Get the Deal data from the choosen keywords and parameters */ - public function collectDataKeywords() + protected function collectDataKeywords() { $q = $this->getInput('q'); $hide_expired = $this->getInput('hide_expired'); @@ -199,7 +199,7 @@ class PepperBridgeAbstract extends BridgeAbstract { /** * Get the Deal data using the given URL */ - public function collectDeals($url){ + protected function collectDeals($url){ $html = getSimpleHTMLDOM($url) or returnServerError($this->i8n('request-error')); $list = $html->find('article[id]'); @@ -575,7 +575,7 @@ class PepperBridgeAbstract extends BridgeAbstract { * the "$lang" class variable in the local class * @return various the local content needed */ - public function i8n($key) + protected function i8n($key) { if (array_key_exists($key, $this->lang)) { return $this->lang[$key]; diff --git a/bridges/ElloBridge.php b/bridges/ElloBridge.php index 885ede8..07a9108 100644 --- a/bridges/ElloBridge.php +++ b/bridges/ElloBridge.php @@ -58,7 +58,7 @@ class ElloBridge extends BridgeAbstract { } - public function findText($path) { + private function findText($path) { foreach($path as $summaryElement) { @@ -72,7 +72,7 @@ class ElloBridge extends BridgeAbstract { } - public function getPostContent($path) { + private function getPostContent($path) { $content = ''; foreach($path as $summaryElement) { @@ -93,7 +93,7 @@ class ElloBridge extends BridgeAbstract { } - public function getEnclosures($post, $postData) { + private function getEnclosures($post, $postData) { $assets = []; foreach($post->links->assets as $asset) { @@ -109,7 +109,7 @@ class ElloBridge extends BridgeAbstract { } - public function getUsername($post, $postData) { + private function getUsername($post, $postData) { foreach($postData->linked->users as $user) { if($user->id == $post->links->author->id) { @@ -119,7 +119,7 @@ class ElloBridge extends BridgeAbstract { } - public function getAPIKey() { + private function getAPIKey() { $cache = Cache::create('FileCache'); $cache->setPath(CACHE_DIR); $cache->setParameters(['key']); diff --git a/bridges/FB2Bridge.php b/bridges/FB2Bridge.php index 1aeb30d..c06ad2d 100644 --- a/bridges/FB2Bridge.php +++ b/bridges/FB2Bridge.php @@ -275,7 +275,4 @@ EOD; return 'http://facebook.com'; } - public function getCacheDuration(){ - return 60 * 60 * 3; // 5 minutes - } } diff --git a/bridges/FilterBridge.php b/bridges/FilterBridge.php index a20b5b9..c644911 100644 --- a/bridges/FilterBridge.php +++ b/bridges/FilterBridge.php @@ -6,6 +6,7 @@ class FilterBridge extends FeedExpander { const NAME = 'Filter'; const CACHE_TIMEOUT = 3600; // 1h const DESCRIPTION = 'Filters a feed of your choice'; + const URI = 'https://github.com/rss-bridge/rss-bridge'; const PARAMETERS = array(array( 'url' => array( diff --git a/bridges/PixivBridge.php b/bridges/PixivBridge.php index 3a4cc93..cc5eaea 100644 --- a/bridges/PixivBridge.php +++ b/bridges/PixivBridge.php @@ -48,7 +48,7 @@ class PixivBridge extends BridgeAbstract { } } - public function cacheImage($url, $illustId) { + private function cacheImage($url, $illustId) { $url = str_replace('_master1200', '', $url); $url = str_replace('c/240x240/img-master/', 'img-original/', $url); diff --git a/bridges/SupInfoBridge.php b/bridges/SupInfoBridge.php index 40160e4..9be5c6a 100644 --- a/bridges/SupInfoBridge.php +++ b/bridges/SupInfoBridge.php @@ -31,7 +31,7 @@ class SupInfoBridge extends BridgeAbstract { } } - public function fetchArticle($link) { + private function fetchArticle($link) { $articleHTML = getSimpleHTMLDOM(self::URI . $link) or returnServerError('Unable to fetch article !'); diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 05c146c..fe527a9 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -354,7 +354,7 @@ class VkBridge extends BridgeAbstract } - public function getContents() + private function getContents() { ini_set('user-agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0'); diff --git a/bridges/YGGTorrentBridge.php b/bridges/YGGTorrentBridge.php index 38eca30..74d0aa0 100644 --- a/bridges/YGGTorrentBridge.php +++ b/bridges/YGGTorrentBridge.php @@ -127,7 +127,7 @@ class YGGTorrentBridge extends BridgeAbstract { } - public function collectTorrentData($url) { + private function collectTorrentData($url) { //For weird reason, the link we get can be invalid, we fix it. $url_full = explode('/', $url);