Skip to content

Commit

Permalink
Code-style patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Sep 2, 2024
1 parent 219abbb commit 854c015
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
[2024.07.13; Bug-fix; Maikuolan]: If the client-specified language was the same as the configured language, the client-specified preferred variant would be ignored, even if it wasn't the same as the configured preferred variant; Fixed.

[2024.08.06; Maikuolan]: Updated the default filetype blacklist (#7).

[2024.09.02; Maikuolan]: Code-style patch.
49 changes: 21 additions & 28 deletions src/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* License: GNU/GPLv2
* @see LICENSE.txt
*
* This file: The scanner (last modified: 2024.03.21).
* This file: The scanner (last modified: 2024.09.02).
*/

namespace phpMussel\Core;
Expand Down Expand Up @@ -3632,37 +3632,30 @@ private function safeBrowseLookup(array $URLs, array $URLsNoLookup = [], array $
* @link https://developers.google.com/safe-browsing/v4/status-codes
*/
if (isset($this->Loader->MostRecentHttpCode) && $this->Loader->MostRecentHttpCode !== 200) {
/**
* Malformed request detected (e.g., invalid argument, invalid
* request payload, etc).
*/
if ($this->Loader->MostRecentHttpCode === '400') {
/**
* Malformed request detected (e.g., invalid argument, invalid request payload,
* etc).
*/
$returnVal = 400;
}

/**
* Unauthorised (most likely an invalid API key used). Returning
* the same message for 401 and 403 because the returned message is
* suitable either way.
*/
elseif ($this->Loader->MostRecentHttpCode >= '401' && $this->Loader->MostRecentHttpCode <= 403) {
} elseif ($this->Loader->MostRecentHttpCode >= '401' && $this->Loader->MostRecentHttpCode <= 403) {
/**
* Unauthorised (most likely an invalid API key used). Returning the same
* message for 401 and 403 because the returned message is suitable either way.
*/
$returnVal = 401;
}

/**
* Service unavailable or internal server error. Returning the same
* message for 429, 500, 503, 504 alike because, for our purpose,
* the returned message is suitable in any case.
*/
elseif ($this->Loader->MostRecentHttpCode >= '429') {
} elseif ($this->Loader->MostRecentHttpCode >= '429') {
/**
* Service unavailable or internal server error. Returning the same message for
* 429, 500, 503, 504 alike because, for our purpose, the returned message is
* suitable in any case.
*/
$returnVal = 503;
}

/**
* Fallback for other error codes (in theory, this shouldn't ever
* be reached, but adding it here just in case).
*/
else {
} else {
/**
* Fallback for other error codes (in theory, this shouldn't ever be reached, but
* adding it here just in case).
*/
$returnVal = 999;
}

Expand Down

0 comments on commit 854c015

Please sign in to comment.