1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-22 08:03:52 +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

@@ -45,7 +45,7 @@ class ThePirateBayBridge extends BridgeAbstract {
$guessedDate = explode('Uploaded ', $guessedDate)[1];
$guessedDate = explode(',', $guessedDate)[0];
if(count(explode(':', $guessedDate)) == 1){
if(count(explode(':', $guessedDate)) == 1) {
$guessedDate = strptime($guessedDate, '%m-%d %Y');
$timestamp = mktime(
0,
@@ -55,7 +55,7 @@ class ThePirateBayBridge extends BridgeAbstract {
$guessedDate['tm_mday'],
1900 + $guessedDate['tm_year']
);
} elseif(explode(' ', $guessedDate)[0] == 'Today'){
} elseif(explode(' ', $guessedDate)[0] == 'Today') {
$guessedDate = strptime(
explode(' ', $guessedDate)[1], '%H:%M'
);
@@ -68,7 +68,7 @@ class ThePirateBayBridge extends BridgeAbstract {
date('d'),
date('Y')
);
} elseif(explode(' ', $guessedDate)[0] == 'Y-day'){
} elseif(explode(' ', $guessedDate)[0] == 'Y-day') {
$guessedDate = strptime(
explode(' ', $guessedDate)[1], '%H:%M'
);
@@ -95,17 +95,17 @@ class ThePirateBayBridge extends BridgeAbstract {
}
$catBool = $this->getInput('cat_check');
if($catBool){
if($catBool) {
$catNum = $this->getInput('cat');
}
$critList = $this->getInput('crit');
$trustedBool = $this->getInput('trusted');
$keywordsList = explode(';', $this->getInput('q'));
foreach($keywordsList as $keywords){
switch($critList){
foreach($keywordsList as $keywords) {
switch($critList) {
case 'search':
if($catBool == false){
if($catBool == false) {
$html = getSimpleHTMLDOM(
self::URI .
'search/' .
@@ -143,11 +143,11 @@ class ThePirateBayBridge extends BridgeAbstract {
if ($html->find('table#searchResult', 0) == false)
returnServerError('No result for query ' . $keywords);
foreach($html->find('tr') as $element){
foreach($html->find('tr') as $element) {
if(!$trustedBool
|| !is_null($element->find('img[alt=VIP]', 0))
|| !is_null($element->find('img[alt=Trusted]', 0))){
|| !is_null($element->find('img[alt=Trusted]', 0))) {
$item = array();
$item['uri'] = $element->find('a', 3)->href;
$item['id'] = self::URI . $element->find('a.detLink', 0)->href;