Showing 104 of 7,594 total issues
File db-admin.php
has 4793 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// Attogram Framework - Database Module - phpLiteAdmin mod v0.0.5
//
// Project: phpLiteAdmin (https://bitbucket.org/phpliteadmin/public)
Function alterTable
has a Cognitive Complexity of 273 (exceeds 5 allowed). Consider refactoring. Open
public function alterTable($table, $alterdefs)
{
global $debug, $lang;
$this->alterError="";
$errormsg = sprintf($lang['alter_failed'],htmlencode($table)).' - ';
- 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 alterTable
has 332 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alterTable($table, $alterdefs)
{
global $debug, $lang;
$this->alterError="";
$errormsg = sprintf($lang['alter_failed'],htmlencode($table)).' - ';
Function export_sql
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
public function export_sql($tables, $drop, $structure, $data, $transaction, $comments)
{
global $lang;
if($comments)
{
- 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 export_csv
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public function export_csv($tables, $field_terminate, $field_enclosed, $field_escaped, $null, $crlf, $fields_in_first_row)
{
$field_enclosed = $field_enclosed;
$query = "SELECT * FROM sqlite_master WHERE type='table' or type='view' ORDER BY type DESC";
$result = $this->selectArray($query);
- 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 selectArray
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function selectArray($query, $mode="both")
{
$result = $this->query($query);
//make sure the result is valid
if($result=== false || $result===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
Function select
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function select($query, $mode="both")
{
$result = $this->query($query);
if(!$result) //make sure the result is valid
return 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
Function import_csv
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function import_csv($filename, $table, $field_terminate, $field_enclosed, $field_escaped, $null, $fields_in_first_row)
{
// CSV import implemented by Christopher Kramer - http://www.christosoft.de
$csv_handle = fopen($filename,'r');
$csv_insert = "BEGIN;\n";
- 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
Database
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Database
{
protected $db; //reference to the DB object
protected $type; //the extension for PHP that handles SQLite
protected $data;
Function explode_sql
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function explode_sql($delimiter, $sql)
{
$ign = array('"' => '"', "'" => "'", "/*" => "*/", "--" => "\n"); // Ignore sequences.
$out = array();
$last = 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
File SqliteDatabase.php
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php // Attogram Framework - Database Module - SqliteDatabase class v0.3.20
namespace Attogram;
/**
Method export_sql
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function export_sql($tables, $drop, $structure, $data, $transaction, $comments)
{
global $lang;
if($comments)
{
Method tabler
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tabler(
$table,
$tableId,
$nameSingular,
$namePlural, // TODO - remove unused
Consider simplifying this complex logical expression. Open
if(!isset($_GET['confirm']) && $target_table && isset($_GET['action']) && ($_GET['action']=="table_export" || $_GET['action']=="table_import" || $_GET['action']=="table_sql" || $_GET['action']=="row_view" || $_GET['action']=="row_create" || $_GET['action']=="column_view" || $_GET['action']=="table_rename" || $_GET['action']=="table_search" || $_GET['action']=="table_triggers"))
{
//- HTML: tabs for tables
if($target_table_type == 'table')
{
Function __construct
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($data)
{
global $lang;
$this->data = $data;
try
- 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 dir_tree
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function dir_tree($dir)
{
$path = '';
$stack[] = $dir;
while($stack)
- 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 export_csv
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function export_csv($tables, $field_terminate, $field_enclosed, $field_escaped, $null, $crlf, $fields_in_first_row)
{
$field_enclosed = $field_enclosed;
$query = "SELECT * FROM sqlite_master WHERE type='table' or type='view' ORDER BY type DESC";
$result = $this->selectArray($query);
Method __construct
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($data)
{
global $lang;
$this->data = $data;
try
Function get_type_affinity
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function get_type_affinity($type)
{
if (preg_match("/INT/i", $type))
return "INTEGER";
else if (preg_match("/(?:CHAR|CLOB|TEXT)/i", $type))
- 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 tabler
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function tabler(
$table,
$tableId,
$nameSingular,
$namePlural, // TODO - remove unused
- 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"