Skip to content

Commit

Permalink
[.travis] Fix several phpcs and phpunit errors (RSS-Bridge#1799)
Browse files Browse the repository at this point in the history
  • Loading branch information
em92 authored Oct 15, 2020
1 parent 64ec488 commit 645a8f6
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 47 deletions.
8 changes: 1 addition & 7 deletions bridges/AlbionOnlineBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ class AlbionOnlineBridge extends BridgeAbstract {
const PARAMETERS = array( array(
'postcount' => array(
'name' => 'Limit',
'type' => 'list',
'values' => array(
'2' => 2,
'5' => 5,
'10' => 10,
'15' => 15,
),
'type' => 'number',
'title' => 'Maximum number of items to return',
'defaultValue' => 5,
),
Expand Down
4 changes: 2 additions & 2 deletions bridges/CeskaTelevizeBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public function collectData() {
}
}

public function getUri() {
return isset($this->feedUri) ? $this->feedUri : parent::getUri();
public function getURI() {
return isset($this->feedUri) ? $this->feedUri : parent::getURI();
}

public function getName() {
Expand Down
1 change: 1 addition & 0 deletions bridges/DiarioDeNoticiasBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function getName() {
}
return $name;
}

public function getURI() {
switch($this->queriedContext) {
case 'Tag':
Expand Down
2 changes: 1 addition & 1 deletion bridges/DribbbleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ private function getImageTag($preview_path, $title){
}

private function getFullSizeImagePath($preview_path){
return explode("?compress=1", $preview_path)[0];
return explode('?compress=1', $preview_path)[0];
}
}
9 changes: 1 addition & 8 deletions bridges/EpicgamesBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ class EpicgamesBridge extends BridgeAbstract {
const PARAMETERS = array( array(
'postcount' => array(
'name' => 'Limit',
'type' => 'list',
'values' => array(
'5' => 5,
'10' => 10,
'15' => 15,
'20' => 20,
'25' => 25,
),
'type' => 'number',
'title' => 'Maximum number of items to return',
'defaultValue' => 10,
),
Expand Down
9 changes: 5 additions & 4 deletions bridges/FM4Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class FM4Bridge extends BridgeAbstract
)
);

public function getPageData($tag, $page) {
private function getPageData($tag, $page) {
if($tag)
$uri = self::URI . "/tags/" . $tag;
$uri = self::URI . '/tags/' . $tag;
else
$uri = self::URI;

Expand All @@ -47,7 +47,7 @@ public function getPageData($tag, $page) {
$item['uri'] = $article->find('a', 0)->href;
$item['title'] = $article->find('h2', 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')) {
$item['content'] = getSimpleHTMLDOM($item['uri'])->find('div[class=storyText]', 0)->innertext
Expand All @@ -58,9 +58,10 @@ public function getPageData($tag, $page) {
}
return $page_items;
}

public function collectData() {
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));
}
}
}
2 changes: 1 addition & 1 deletion bridges/FicbookBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function collectData() {

$html = defaultLinkTo($html, self::URI);

if ($this->queriedContext == 'Fiction Updates' or $this->queriedContext == 'Fiction Comments' ) {
if ($this->queriedContext == 'Fiction Updates' or $this->queriedContext == 'Fiction Comments') {
$this->titleName = $html->find('.fanfic-main-info > h1', 0)->innertext;
}

Expand Down
16 changes: 8 additions & 8 deletions bridges/MarktplaatsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public function collectData() {
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
}
}
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents/100;
$item['content'] .= "&nbsp;&nbsp;(" . $listing->priceInfo->priceType .")";
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents / 100;
$item['content'] .= '&nbsp;&nbsp;(' . $listing->priceInfo->priceType . ')';
if(!empty($listing->location->cityName)) {
$item['content'] .= "<br><br>\n" . $listing->location->cityName;
}
Expand All @@ -117,11 +117,11 @@ public function collectData() {
}
}
}

public function getName(){
if(!is_null($this->getInput('q'))) {
return $this->getInput('q') . ' - Marktplaats';
}
return parent::getName();
}
if(!is_null($this->getInput('q'))) {
return $this->getInput('q') . ' - Marktplaats';
}
return parent::getName();
}
}
8 changes: 4 additions & 4 deletions bridges/MondeDiploBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class MondeDiploBridge extends BridgeAbstract {
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = 'Returns most recent results from MondeDiplo.';

private function cleanText($text) {
return trim(str_replace(['&nbsp;', '&nbsp'], ' ', $text));
}
private function cleanText($text) {
return trim(str_replace(array('&nbsp;', '&nbsp'), ' ', $text));
}

public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
Expand All @@ -22,7 +22,7 @@ public function collectData(){
$item = array();
$item['uri'] = self::URI . $element->href;
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion bridges/NasaApodBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function collectData(){
$picture_html_string = $picture_html->innertext;

//Extract image and explanation
$image_wrapper = $picture_html->find('a',1);
$image_wrapper = $picture_html->find('a', 1);
$image_path = $image_wrapper->href;
$img_placeholder = $image_wrapper->find('img', 0);
$img_alt = $img_placeholder->alt;
Expand Down
9 changes: 7 additions & 2 deletions bridges/NordbayernBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ class NordbayernBridge extends BridgeAbstract {
));

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])) {
return stripcslashes($matches[1][0]) . '?w=800';
}
return null;
return null;
}

private function handleArticle($link) {
Expand Down
8 changes: 5 additions & 3 deletions bridges/OtrkeyFinderBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ class OtrkeyFinderBridge extends BridgeAbstract {
'searchterm' => array(
'name' => 'Search term',
'exampleValue' => 'Terminator',
'defaultValue' => '',
'title' => 'The search term is case-insensitive',
),
'station' => array(
'name' => 'Station name',
'exampleValue' => 'ARD',
'defaultValue' => '',
),
'type' => array(
'name' => 'Media type',
Expand Down Expand Up @@ -143,7 +141,11 @@ private function buildItem(simple_html_dom_node $node) {
$item['content'] = $content;

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;
Expand Down
2 changes: 1 addition & 1 deletion bridges/ReleasesSwitchBridge.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// This bridge depends on Releases3DSBridge
if (!class_exists('Releases3DSBridge')){
if (!class_exists('Releases3DSBridge')) {
include('Releases3DSBridge.php');
}

Expand Down
8 changes: 3 additions & 5 deletions bridges/WorldCosplayBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class WorldCosplayBridge extends BridgeAbstract {
const NAME = 'WorldCosplay Bridge';
const URI = 'https://worldcosplay.net/';
const DESCRIPTION ='Returns WorldCosplay photos';
const DESCRIPTION = 'Returns WorldCosplay photos';
const MAINTAINER = 'AxorPL';

const API_CHARACTER = 'api/photo/list.json?character_id=%u&limit=%u';
Expand Down Expand Up @@ -95,14 +95,12 @@ public function collectData() {

$json = json_decode(getContents($url))
or returnServerError(sprintf(self::ERR_QUERY, $url));
if($json->has_error)
{
if($json->has_error) {
returnServerError($json->message);
}
$list = $json->list;

foreach($list as $img)
{
foreach($list as $img) {
$item = array();
$item['uri'] = self::URI . substr($img->photo->url, 1);
$item['title'] = $img->photo->subject;
Expand Down

0 comments on commit 645a8f6

Please sign in to comment.