From 092831894347cc369249740e9fe4d4a29e409833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoit=2ES=20=C2=AB=C2=A0Benpro=C2=A0=C2=BB?= Date: Thu, 6 Feb 2014 11:54:26 +0100 Subject: [PATCH] Fix bridges FSBridge & GuruMedBridge due to PSR-2: "Visibility MUST be declared on all methods." --- bridges/FSBridge.php | 36 +++++++++++++++++++----------------- bridges/GuruMedBridge.php | 36 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/bridges/FSBridge.php b/bridges/FSBridge.php index 51c0e9b0..1e7b175a 100644 --- a/bridges/FSBridge.php +++ b/bridges/FSBridge.php @@ -8,33 +8,35 @@ */ class FSBridge extends BridgeAbstract { + public function FS_StripCDATA($string) + { + $string = str_replace('', '', $string); + + return $string; + } + + public function FS_ExtractContent($url) + { + $html2 = file_get_html($url); + $text = $html2->find('div.fiche-actualite', 0)->innertext; + + return $text; + } + public function collectData(array $param) { - public function FS_StripCDATA($string) - { - $string = str_replace('', '', $string); - return $string; - } - - public function FS_ExtractContent($url) - { - $html2 = file_get_html($url); - $text = $html2->find('div.fiche-actualite', 0)->innertext; - - return $text; - } $html = file_get_html('http://www.futura-sciences.com/rss/actualites.xml') or $this->returnError('Could not request Futura Sciences.', 404); $limit = 0; foreach ($html->find('item') as $element) { if ($limit < 20) { $item = new \Item(); - $item->title = FS_StripCDATA($element->find('title', 0)->innertext); - $item->uri = FS_StripCDATA($element->find('guid', 0)->plaintext); + $item->title = $this->FS_StripCDATA($element->find('title', 0)->innertext); + $item->uri = $this->FS_StripCDATA($element->find('guid', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = FS_ExtractContent($item->uri); + $item->content = $this->FS_ExtractContent($item->uri); $this->items[] = $item; $limit++; } diff --git a/bridges/GuruMedBridge.php b/bridges/GuruMedBridge.php index b7f2268e..fffaa95a 100644 --- a/bridges/GuruMedBridge.php +++ b/bridges/GuruMedBridge.php @@ -8,33 +8,35 @@ */ class GuruMedBridge extends BridgeAbstract { + public function GurumedStripCDATA($string) + { + $string = str_replace('', '', $string); + + return $string; + } + + public function GurumedExtractContent($url) + { + $html2 = file_get_html($url); + $text = $html2->find('div.entry', 0)->innertext; + + return $text; + } + public function collectData(array $param) { - public function GurumedStripCDATA($string) - { - $string = str_replace('', '', $string); - return $string; - } - - public function GurumedExtractContent($url) - { - $html2 = file_get_html($url); - $text = $html2->find('div.entry', 0)->innertext; - - return $text; - } $html = file_get_html('http://gurumed.org/feed') or $this->returnError('Could not request Gurumed.', 404); $limit = 0; foreach ($html->find('item') as $element) { if ($limit < 10) { $item = new \Item(); - $item->title = GurumedStripCDATA($element->find('title', 0)->innertext); - $item->uri = GurumedStripCDATA($element->find('guid', 0)->plaintext); + $item->title = $this->GurumedStripCDATA($element->find('title', 0)->innertext); + $item->uri = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = GurumedExtractContent($item->uri); + $item->content = $this->GurumedExtractContent($item->uri); $this->items[] = $item; $limit++; }