File Export.php
has 864 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* function for the main export logic
*/
Function exportDatabase
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
public function exportDatabase(
DatabaseName $db,
array $tables,
string $whatStrucOrData,
array $tableStructure,
- 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 outputHandler
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
public function outputHandler(string $line): bool
{
$GLOBALS['time_start'] ??= null;
$GLOBALS['save_filename'] ??= null;
- 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 exportDatabase
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportDatabase(
DatabaseName $db,
array $tables,
string $whatStrucOrData,
array $tableStructure,
Function exportTable
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function exportTable(
string $db,
string $table,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
- 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 exportTable
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportTable(
string $db,
string $table,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
Function mergeAliases
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function mergeAliases(array $aliases1, array $aliases2): array
{
// First do a recursive array merge
// on aliases arrays.
$aliases = array_merge_recursive($aliases1, $aliases2);
- 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
Export
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Export
{
public string $dumpBuffer = '';
public int $dumpBufferLength = 0;
Method outputHandler
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function outputHandler(string $line): bool
{
$GLOBALS['time_start'] ??= null;
$GLOBALS['save_filename'] ??= null;
Method exportTable
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
string $db,
string $table,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
string $errorUrl,
Method exportDatabase
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
DatabaseName $db,
array $tables,
string $whatStrucOrData,
array $tableStructure,
array $tableData,
Method openFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function openFile(string $filename, bool $quickExport): array
{
$fileHandle = null;
$message = null;
$doNotSaveItOver = true;
Method exportServer
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
string|array $dbSelect,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
string $errorUrl,
string $exportType,
Function getFilenameAndMimetype
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getFilenameAndMimetype(
string $exportType,
string $rememberTemplate,
ExportPlugin $exportPlugin,
string $compression,
- 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 exportServer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportServer(
string|array $dbSelect,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
string $errorUrl,
Method mergeAliases
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mergeAliases(array $aliases1, array $aliases2): array
{
// First do a recursive array merge
// on aliases arrays.
$aliases = array_merge_recursive($aliases1, $aliases2);
Function exportServer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function exportServer(
string|array $dbSelect,
string $whatStrucOrData,
ExportPlugin $exportPlugin,
string $errorUrl,
- 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 openFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function openFile(string $filename, bool $quickExport): array
{
$fileHandle = null;
$message = null;
$doNotSaveItOver = true;
- 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 (
@file_exists($saveFilename)
&& ((! $quickExport && empty($_POST['onserver_overwrite']))
|| ($quickExport
&& $doNotSaveItOver))
Method getFilenameAndMimetype
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $exportType,
string $rememberTemplate,
ExportPlugin $exportPlugin,
string $compression,
string $filenameTemplate,
Method exportRaw
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $whatStrucOrData,
ExportPlugin $exportPlugin,
string $errorUrl,
string|null $db,
string $sqlQuery,
Function getHTMLForRefreshButton
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getHTMLForRefreshButton(string $exportType): string
{
$postParams = $this->getPostParams($exportType);
$refreshButton = '<form id="export_refresh_form" method="POST" action="'
- 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Function getPostParams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getPostParams(string $exportType): array
{
$postParams = $_POST;
// Convert the multiple select elements from an array to a string
- 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"