File ErrorHandler.php
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Error;
ErrorHandler
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class ErrorHandler
{
public static self|null $instance = null;
/**
Method reportErrors
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reportErrors(): void
{
// if there're no actual errors,
if (! $this->hasErrors() || $this->countErrors() === $this->countUserErrors()) {
// then simply return.
Function getDispErrors
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getDispErrors(): string
{
$retval = '';
// display errors if SendErrorReports is set to 'ask'.
$config = Config::getInstance();
- 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 getDispErrors
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDispErrors(): string
{
$retval = '';
// display errors if SendErrorReports is set to 'ask'.
$config = Config::getInstance();
Method addError
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addError(
string $errstr,
int $errno,
string $errfile,
int $errline,
Function reportErrors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function reportErrors(): void
{
// if there're no actual errors,
if (! $this->hasErrors() || $this->countErrors() === $this->countUserErrors()) {
// then simply return.
- 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 handleError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handleError(
int $errno,
string $errstr,
string $errfile,
int $errline,
- 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 __destruct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __destruct()
{
if (! isset($_SESSION['errors'])) {
$_SESSION['errors'] = [];
}
- 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 addError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $errstr,
int $errno,
string $errfile,
int $errline,
bool $escape = true,
Function countUserErrors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function countUserErrors(): int
{
$count = 0;
if ($this->countErrors() !== 0) {
foreach ($this->getErrors() as $error) {
- 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 checkSavedErrors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function checkSavedErrors(): void
{
if (! isset($_SESSION['errors'])) {
return;
}
- 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"