Function removeRequestVars
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function removeRequestVars(array $allowList): void
{
// do not check only $_REQUEST because it could have been overwritten
// and use type casting because the variables could have become
// strings
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkLink
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function checkLink(string $url, bool $http = false, bool $other = false): bool
{
$url = strtolower($url);
$validStarts = ['https://', 'index.php?route=/url&url=https%3a%2f%2f', './docs/html/', './index.php?'];
$isSetup = self::isSetup();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method convertBBCode
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function convertBBCode(string $message, bool $safe = false): string
{
if (! $safe) {
$message = strtr($message, ['<' => '<', '>' => '>', '"' => '"', "'" => ''']);
}
Method checkLink
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkLink(string $url, bool $http = false, bool $other = false): bool
{
$url = strtolower($url);
$validStarts = ['https://', 'index.php?route=/url&url=https%3a%2f%2f', './docs/html/', './index.php?'];
$isSetup = self::isSetup();
Function replaceBBLink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function replaceBBLink(array $found): string
{
/* Check for valid link */
if (! self::checkLink($found[1])) {
return $found[0];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function replaceDocLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function replaceDocLink(array $found): string
{
if (count($found) >= 4) {
/* doc@page@anchor pattern */
$page = $found[1];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"