1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-28 10:30:12 +02:00

[phpcs] Add missing rules

- Do not add spaces after opening or before closing parenthesis

  // Wrong
  if( !is_null($var) ) {
    ...
  }

  // Right
  if(!is_null($var)) {
    ...
  }

- Add space after closing parenthesis

  // Wrong
  if(true){
    ...
  }

  // Right
  if(true) {
    ...
  }

- Add body into new line
- Close body in new line

  // Wrong
  if(true) { ... }

  // Right
  if(true) {
    ...
  }

Notice: Spaces after keywords are not detected:

  // Wrong (not detected)
  // -> space after 'if' and missing space after 'else'
  if (true) {
    ...
  } else{
    ...
  }

  // Right
  if(true) {
    ...
  } else {
    ...
  }
This commit is contained in:
logmanoriginal
2017-07-29 19:28:00 +02:00
parent 38b56bf23a
commit a4b9611e66
128 changed files with 692 additions and 694 deletions

View File

@@ -80,7 +80,7 @@ class MangareaderBridge extends BridgeAbstract {
public function collectData(){
// We'll use the DOM parser for this as it makes navigation easier
$html = getContents($this->getURI());
if(!$html){
if(!$html) {
returnClientError('Could not receive data for ' . $path . '!');
}
libxml_use_internal_errors(true);
@@ -92,7 +92,7 @@ class MangareaderBridge extends BridgeAbstract {
$xpath = new DomXPath($doc);
$this->request = '';
switch($this->queriedContext){
switch($this->queriedContext) {
case 'Get latest updates':
$this->request = 'Latest updates';
$this->getLatestUpdates($xpath);
@@ -105,7 +105,7 @@ class MangareaderBridge extends BridgeAbstract {
break;
case 'Get manga updates':
$limit = $this->getInput('limit');
if(empty($limit)){
if(empty($limit)) {
$limit = self::PARAMETERS[$this->queriedContext]['limit']['defaultValue'];
}
@@ -118,7 +118,7 @@ class MangareaderBridge extends BridgeAbstract {
}
// Return some dummy-data if no content available
if(empty($this->items)){
if(empty($this->items)) {
$item = array();
$item['content'] = "<p>No updates available</p>";
@@ -130,14 +130,14 @@ class MangareaderBridge extends BridgeAbstract {
// Query each item (consists of Manga + chapters)
$nodes = $xpath->query("//*[@id='latestchapters']/table//td");
foreach ($nodes as $node){
foreach ($nodes as $node) {
// Query the manga
$manga = $xpath->query("a[@class='chapter']", $node)->item(0);
// Collect the chapters for each Manga
$chapters = $xpath->query("a[@class='chaptersrec']", $node);
if (isset($manga) && $chapters->length >= 1){
if (isset($manga) && $chapters->length >= 1) {
$item = array();
$item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href'));
$item['title'] = htmlspecialchars($manga->nodeValue);
@@ -145,8 +145,8 @@ class MangareaderBridge extends BridgeAbstract {
// Add each chapter to the feed
$item['content'] = "";
foreach ($chapters as $chapter){
if($item['content'] <> ""){
foreach ($chapters as $chapter) {
if($item['content'] <> "") {
$item['content'] .= "<br>";
}
$item['content'] .= "<a href='"
@@ -166,7 +166,7 @@ class MangareaderBridge extends BridgeAbstract {
// Query all mangas
$mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']");
foreach ($mangas as $manga){
foreach ($mangas as $manga) {
// The thumbnail is encrypted in a css-style...
// format: "background-image:url('<the part which is actually interesting>')"
@@ -203,13 +203,13 @@ EOD;
private function getMangaUpdates($xpath, $limit){
$query = "(.//*[@id='listing']//tr)[position() > 1]";
if($limit !== -1){
if($limit !== -1) {
$query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - {$limit}]";
}
$chapters = $xpath->query($query);
foreach ($chapters as $chapter){
foreach ($chapters as $chapter) {
$item = array();
$item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)
->item(0)
@@ -225,13 +225,13 @@ EOD;
}
public function getURI(){
switch($this->queriedContext){
switch($this->queriedContext) {
case 'Get latest updates':
$path = "latest";
break;
case 'Get popular mangas':
$path = "popular";
if($this->getInput('category') !== "all"){
if($this->getInput('category') !== "all") {
$path .= "/" . $this->getInput('category');
}
break;