File Core.php
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace PhpMyAdmin;
Function safeUnserialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function safeUnserialize(string $data): mixed
{
/* validate serialized data */
$length = strlen($data);
$depth = 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
Core
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Core
{
/**
* Removes insecure parts in a path; used before include() or
* require() when a part of the path comes from an insecure source
Method safeUnserialize
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function safeUnserialize(string $data): mixed
{
/* validate serialized data */
$length = strlen($data);
$depth = 0;
Function populateRequestWithEncryptedQueryParams
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function populateRequestWithEncryptedQueryParams(ServerRequest $request): ServerRequest
{
$queryParams = $request->getQueryParams();
$parsedBody = $request->getParsedBody();
- 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 populateRequestWithEncryptedQueryParams
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function populateRequestWithEncryptedQueryParams(ServerRequest $request): ServerRequest
{
$queryParams = $request->getQueryParams();
$parsedBody = $request->getParsedBody();
Method isAllowedDomain
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isAllowedDomain(string $url): bool
{
$parsedUrl = parse_url($url);
if (
! is_array($parsedUrl)
Function arrayRemove
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function arrayRemove(string $path, array &$array): void
{
$keys = explode('/', $path);
$keysLast = array_pop($keys);
$path = [];
- 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
Consider simplifying this complex logical expression. Open
if (
is_array($parsedBody)
&& isset($parsedBody['eq'])
&& is_string($parsedBody['eq'])
&& $parsedBody['eq'] !== ''
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $request;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return unserialize($data);
Function previewSQL
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function previewSQL(array|string $queryData): void
{
$retval = '<div class="preview_sql">';
if ($queryData === '' || $queryData === []) {
$retval .= __('No change');
- 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"