File Common.php
has 457 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Database\Designer;
Function addNewRelation
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function addNewRelation(
string $t1,
string $f1,
string $t2,
string $f2,
- 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 addNewRelation
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addNewRelation(
string $t1,
string $f1,
string $t2,
string $f2,
Function getScriptContr
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getScriptContr(array $designerTables): array
{
$this->dbi->selectDb(Current::$database);
/** @var array{C_NAME: string[], DTN: string[], DCN: string[], STN: string[], SCN: string[]} $con */
$con = ['C_NAME' => [], 'DTN' => [], 'DCN' => [], 'STN' => [], 'SCN' => []];
- 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 getScriptContr
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getScriptContr(array $designerTables): array
{
$this->dbi->selectDb(Current::$database);
/** @var array{C_NAME: string[], DTN: string[], DCN: string[], STN: string[], SCN: string[]} $con */
$con = ['C_NAME' => [], 'DTN' => [], 'DCN' => [], 'STN' => [], 'SCN' => []];
Method saveSetting
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveSetting(string $index, string $value): bool
{
$databaseDesignerSettingsFeature = $this->relation->getRelationParameters()->databaseDesignerSettingsFeature;
if ($databaseDesignerSettingsFeature !== null) {
$cfgDesigner = [
Method removeRelation
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function removeRelation(string $t1, string $f1, string $t2, string $f2): array
{
[$db1, $t1] = explode('.', $t1);
[$db2, $t2] = explode('.', $t2);
Method saveTablePositions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveTablePositions(int $pg): bool
{
$pdfFeature = $this->relation->getRelationParameters()->pdfFeature;
if ($pdfFeature === null) {
return false;
Method addNewRelation
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
string $t1,
string $f1,
string $t2,
string $f2,
string $onDelete,
Avoid too many return
statements within this method. Open
return [false, __('Error: Relational features are disabled!')];
Avoid too many return
statements within this method. Open
return [false, __('Error: Internal relationship could not be added!') . '<br>' . $error];
Avoid too many return
statements within this method. Open
return [true, __('Internal relationship has been added.')];
Function getAllKeys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAllKeys(array $designerTables): array
{
$keys = [];
foreach ($designerTables as $designerTable) {
- 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 removeRelation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function removeRelation(string $t1, string $f1, string $t2, string $f2): array
{
[$db1, $t1] = explode('.', $t1);
[$db2, $t2] = explode('.', $t2);
- 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"