[.travis] Fix several phpcs and phpunit errors (#1799)

This commit is contained in:
Eugene Molotov 2020-10-15 12:53:19 +05:00 committed by GitHub
parent 64ec488f70
commit 645a8f62c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 41 additions and 47 deletions

View file

@ -10,13 +10,7 @@ class AlbionOnlineBridge extends BridgeAbstract {
const PARAMETERS = array( array( const PARAMETERS = array( array(
'postcount' => array( 'postcount' => array(
'name' => 'Limit', 'name' => 'Limit',
'type' => 'list', 'type' => 'number',
'values' => array(
'2' => 2,
'5' => 5,
'10' => 10,
'15' => 15,
),
'title' => 'Maximum number of items to return', 'title' => 'Maximum number of items to return',
'defaultValue' => 5, 'defaultValue' => 5,
), ),

View file

@ -74,8 +74,8 @@ class CeskaTelevizeBridge extends BridgeAbstract {
} }
} }
public function getUri() { public function getURI() {
return isset($this->feedUri) ? $this->feedUri : parent::getUri(); return isset($this->feedUri) ? $this->feedUri : parent::getURI();
} }
public function getName() { public function getName() {

View file

@ -42,6 +42,7 @@ class DiarioDeNoticiasBridge extends BridgeAbstract {
} }
return $name; return $name;
} }
public function getURI() { public function getURI() {
switch($this->queriedContext) { switch($this->queriedContext) {
case 'Tag': case 'Tag':

View file

@ -94,6 +94,6 @@ favicon-63b2904a073c89b52b19aa08cebc16a154bcf83fee8ecc6439968b1e6db569c7.ico';
} }
private function getFullSizeImagePath($preview_path){ private function getFullSizeImagePath($preview_path){
return explode("?compress=1", $preview_path)[0]; return explode('?compress=1', $preview_path)[0];
} }
} }

View file

@ -10,14 +10,7 @@ class EpicgamesBridge extends BridgeAbstract {
const PARAMETERS = array( array( const PARAMETERS = array( array(
'postcount' => array( 'postcount' => array(
'name' => 'Limit', 'name' => 'Limit',
'type' => 'list', 'type' => 'number',
'values' => array(
'5' => 5,
'10' => 10,
'15' => 15,
'20' => 20,
'25' => 25,
),
'title' => 'Maximum number of items to return', 'title' => 'Maximum number of items to return',
'defaultValue' => 10, 'defaultValue' => 10,
), ),

View file

@ -28,9 +28,9 @@ class FM4Bridge extends BridgeAbstract
) )
); );
public function getPageData($tag, $page) { private function getPageData($tag, $page) {
if($tag) if($tag)
$uri = self::URI . "/tags/" . $tag; $uri = self::URI . '/tags/' . $tag;
else else
$uri = self::URI; $uri = self::URI;
@ -47,7 +47,7 @@ class FM4Bridge extends BridgeAbstract
$item['uri'] = $article->find('a', 0)->href; $item['uri'] = $article->find('a', 0)->href;
$item['title'] = $article->find('h2', 0)->plaintext; $item['title'] = $article->find('h2', 0)->plaintext;
$item['author'] = $article->find('p[class*=keyword]', 0)->plaintext; $item['author'] = $article->find('p[class*=keyword]', 0)->plaintext;
$item["timestamp"] = strtotime($article->find('p[class*=time]', 0)->plaintext); $item['timestamp'] = strtotime($article->find('p[class*=time]', 0)->plaintext);
if ($this->getInput('loadcontent')) { if ($this->getInput('loadcontent')) {
$item['content'] = getSimpleHTMLDOM($item['uri'])->find('div[class=storyText]', 0)->innertext $item['content'] = getSimpleHTMLDOM($item['uri'])->find('div[class=storyText]', 0)->innertext
@ -58,6 +58,7 @@ class FM4Bridge extends BridgeAbstract
} }
return $page_items; return $page_items;
} }
public function collectData() { public function collectData() {
for ($cur_page = 1; $cur_page <= $this->getInput('pages'); $cur_page++) { for ($cur_page = 1; $cur_page <= $this->getInput('pages'); $cur_page++) {
$this->items = array_merge($this->items, $this->getPageData($this->getInput('tag'), $cur_page)); $this->items = array_merge($this->items, $this->getPageData($this->getInput('tag'), $cur_page));

View file

@ -104,7 +104,7 @@ class MarktplaatsBridge extends BridgeAbstract {
} }
} }
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents / 100; $item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents / 100;
$item['content'] .= "&nbsp;&nbsp;(" . $listing->priceInfo->priceType .")"; $item['content'] .= '&nbsp;&nbsp;(' . $listing->priceInfo->priceType . ')';
if(!empty($listing->location->cityName)) { if(!empty($listing->location->cityName)) {
$item['content'] .= "<br><br>\n" . $listing->location->cityName; $item['content'] .= "<br><br>\n" . $listing->location->cityName;
} }

View file

@ -8,7 +8,7 @@ class MondeDiploBridge extends BridgeAbstract {
const DESCRIPTION = 'Returns most recent results from MondeDiplo.'; const DESCRIPTION = 'Returns most recent results from MondeDiplo.';
private function cleanText($text) { private function cleanText($text) {
return trim(str_replace(['&nbsp;', '&nbsp'], ' ', $text)); return trim(str_replace(array('&nbsp;', '&nbsp'), ' ', $text));
} }
public function collectData(){ public function collectData(){
@ -22,7 +22,7 @@ class MondeDiploBridge extends BridgeAbstract {
$item = array(); $item = array();
$item['uri'] = self::URI . $element->href; $item['uri'] = self::URI . $element->href;
$item['title'] = $this->cleanText($title) . ' - ' . $this->cleanText($datesAuteurs); $item['title'] = $this->cleanText($title) . ' - ' . $this->cleanText($datesAuteurs);
$item['content'] = $this->cleanText(str_replace([$title, $datesAuteurs], '', $element->plaintext)); $item['content'] = $this->cleanText(str_replace(array($title, $datesAuteurs), '', $element->plaintext));
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -48,7 +48,12 @@ class NordbayernBridge extends BridgeAbstract {
)); ));
private function getImageUrlFromScript($script) { private function getImageUrlFromScript($script) {
preg_match("#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG))#", $script->innertext, $matches, PREG_OFFSET_CAPTURE); preg_match(
"#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG))#",
$script->innertext,
$matches,
PREG_OFFSET_CAPTURE
);
if(isset($matches[1][0])) { if(isset($matches[1][0])) {
return stripcslashes($matches[1][0]) . '?w=800'; return stripcslashes($matches[1][0]) . '?w=800';
} }

View file

@ -11,13 +11,11 @@ class OtrkeyFinderBridge extends BridgeAbstract {
'searchterm' => array( 'searchterm' => array(
'name' => 'Search term', 'name' => 'Search term',
'exampleValue' => 'Terminator', 'exampleValue' => 'Terminator',
'defaultValue' => '',
'title' => 'The search term is case-insensitive', 'title' => 'The search term is case-insensitive',
), ),
'station' => array( 'station' => array(
'name' => 'Station name', 'name' => 'Station name',
'exampleValue' => 'ARD', 'exampleValue' => 'ARD',
'defaultValue' => '',
), ),
'type' => array( 'type' => array(
'name' => 'Media type', 'name' => 'Media type',
@ -143,7 +141,11 @@ class OtrkeyFinderBridge extends BridgeAbstract {
$item['content'] = $content; $item['content'] = $content;
if (preg_match(self::TIME_REGEX, $file, $matches) === 1) { if (preg_match(self::TIME_REGEX, $file, $matches) === 1) {
$item['timestamp'] = DateTime::createFromFormat('y.m.d_H-i', $matches[0], new DateTimeZone('Europe/Berlin'))->getTimestamp(); $item['timestamp'] = DateTime::createFromFormat(
'y.m.d_H-i',
$matches[0],
new DateTimeZone('Europe/Berlin')
)->getTimestamp();
} }
return $item; return $item;

View file

@ -95,14 +95,12 @@ class WorldCosplayBridge extends BridgeAbstract {
$json = json_decode(getContents($url)) $json = json_decode(getContents($url))
or returnServerError(sprintf(self::ERR_QUERY, $url)); or returnServerError(sprintf(self::ERR_QUERY, $url));
if($json->has_error) if($json->has_error) {
{
returnServerError($json->message); returnServerError($json->message);
} }
$list = $json->list; $list = $json->list;
foreach($list as $img) foreach($list as $img) {
{
$item = array(); $item = array();
$item['uri'] = self::URI . substr($img->photo->url, 1); $item['uri'] = self::URI . substr($img->photo->url, 1);
$item['title'] = $img->photo->subject; $item['title'] = $img->photo->subject;