File panel_elements.inc.php
has 579 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// File panel_elements.inc.php / FirebirdWebAdmin
// Purpose functions for generating html-code that is needed in various panels
// Author Lutz Brueckner <irie@gmx.de>
// Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005 by Lutz Brueckner,
Method get_column_constraint_definition
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_column_constraint_definition($coldefs, $idx)
{
global $fk_actions, $tb_strings;
$fk_name = isset($coldefs['fk_name']) ? $coldefs['fk_name'] : '';
Function get_tables_names
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function get_tables_names($restrictions = array())
{
global $s_tables, $s_login;
$rights = array('S' => 'select',
- 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 get_datatype_definition
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_datatype_definition($idx, $title, $rowspan = 1, $collate = false)
{
global $s_coldefs, $tb_strings;
// preselect values for the form elements
Method get_opened_table
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_opened_table($name, $title, $url, $curl = '', $cdiv = '')
{
global $s_fields, $tb_strings, $ptitle_strings;
$html = <<<EOT
Method get_coldef_definition
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_coldef_definition($idx, $title, $rowspan, $collate = false)
{
global $s_coldefs, $tb_strings, $s_domains;
$coldefs = isset($s_coldefs[$idx]) ? $s_coldefs[$idx] : array();
Function get_column_constraint_definition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function get_column_constraint_definition($coldefs, $idx)
{
global $fk_actions, $tb_strings;
$fk_name = isset($coldefs['fk_name']) ? $coldefs['fk_name'] : '';
- 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 get_tables_names
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_tables_names($restrictions = array())
{
global $s_tables, $s_login;
$rights = array('S' => 'select',
Consider simplifying this complex logical expression. Open
if ($idx == 'mod' &&
((isset($coldefs['primary']) && $coldefs['primary_cols'] == 1) ||
(isset($coldefs['unique']) && $coldefs['unique_cols'] == 1) ||
(isset($coldefs['foreign']) && $coldefs['foreign_cols'] == 1)
)
Method get_textfield
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_textfield($name, $size, $maxlength = null, $value = null, $type = 'text', $tags = array())
Method get_table_selectlist
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_table_selectlist($name, $restrictions = array(), $sel = null, $empty = false, $tags = array(), $size = 1)
Method get_selectlist
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
Method get_indexed_selectlist
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_indexed_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
Method get_opened_table
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_opened_table($name, $title, $url, $curl = '', $cdiv = '')
Function get_indexed_selectlist
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_indexed_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
{
$sel = is_array($sel) ? array_map('htmlspecialchars', $sel) : htmlspecialchars($sel);
$html = '<select class="form-control" id="'.$name.'" name="'.$name.'" size="'.$size.'"'.get_tags_string($tags).">\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
Function get_sysdba_pw
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function get_sysdba_pw()
{
if ($GLOBALS['s_login']['user'] == 'SYSDBA') {
return $GLOBALS['s_login']['password'];
}
- 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 table_column_detail_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function table_column_detail_string($haveit, $source, $showit)
{
$str = '';
if ($haveit == true) {
if ($showit == true && !empty($source)) {
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (isset($coldefs['unique']) && $coldefs['unique_cols'] == 1) {
$checked_str = $coldefs['uq_del'] == true ? ' checked' : '';
$drop_element .= " <td>\n"
.' <label><input type="checkbox" name="cd_def_uq_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropUq']."</b>\n</label>"
." </td>\n";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (isset($coldefs['foreign']) && $coldefs['foreign_cols'] == 1) {
$checked_str = $coldefs['fk_del'] == true ? ' checked' : '';
$drop_element .= " <td>\n"
.' <label><input type="checkbox" name="cd_def_fk_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropFK']."</b>\n</label>"
." </td>\n";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (isset($coldefs['primary']) && $coldefs['primary_cols'] == 1) {
$checked_str = $coldefs['pk_del'] == true ? ' checked' : '';
$drop_element .= " <td>\n"
.' <label><input type="checkbox" name="cd_def_pk_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropPK']."</b>\n</label>"
." </td>\n";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76