run phpcbf on BloombergBridge

This commit is contained in:
Matt DeMoss 2017-12-23 11:43:29 -05:00
parent b4d0098c8a
commit f7106c3137

View File

@ -1,5 +1,6 @@
<?php <?php
class BloombergBridge extends BridgeAbstract { class BloombergBridge extends BridgeAbstract
{
const NAME = 'Bloomberg'; const NAME = 'Bloomberg';
const URI = 'https://www.bloomberg.com/'; const URI = 'https://www.bloomberg.com/';
const DESCRIPTION = 'Trending stories from Bloomberg'; const DESCRIPTION = 'Trending stories from Bloomberg';
@ -15,7 +16,8 @@ class BloombergBridge extends BridgeAbstract {
) )
); );
public function getName(){ public function getName()
{
switch($this->queriedContext) { switch($this->queriedContext) {
case 'Trending Stories': case 'Trending Stories':
return self::NAME . ' Trending Stories'; return self::NAME . ' Trending Stories';
@ -29,10 +31,11 @@ class BloombergBridge extends BridgeAbstract {
return parent::getName(); return parent::getName();
} }
public function collectData(){ public function collectData()
{
switch($this->queriedContext) { switch($this->queriedContext) {
case 'Trending Stories': // Get list of top new <article>s from the front page. case 'Trending Stories': // Get list of top new <article>s from the front page.
$html = getSimpleHTMLDOMCached($this->getURI(),300); $html = getSimpleHTMLDOMCached($this->getURI(), 300);
$stories = $html->find('ul.top-news-v3__stories article.top-news-v3-story'); $stories = $html->find('ul.top-news-v3__stories article.top-news-v3-story');
break; break;
case 'From Search': // Get list of <article> elements from search. case 'From Search': // Get list of <article> elements from search.
@ -51,7 +54,7 @@ class BloombergBridge extends BridgeAbstract {
} }
$item['title'] = $element->find('h1 a', 0)->plaintext; $item['title'] = $element->find('h1 a', 0)->plaintext;
$item['timestamp'] = strtotime($articleHtml->find('meta[name=iso-8601-publish-date],meta[name=date]', 0)->content); $item['timestamp'] = strtotime($articleHtml->find('meta[name=iso-8601-publish-date],meta[name=date]', 0)->content);
$item['content'] = $articleHtml->find('meta[name=description]',0)->content; $item['content'] = $articleHtml->find('meta[name=description]', 0)->content;
$this->items[] = $item; $this->items[] = $item;
} }
} }