File MyBlocksAdmin.class.php
has 821 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// $Id: MyBlocksAdmin.class.php ,ver 0.0.7.1 2011/02/15 02:55:00 domifara Exp $
class MyBlocksAdmin
{
MyBlocksAdmin
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class MyBlocksAdmin
{
public $db ;
public $lang ;
Method form_edit
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form_edit($bid, $mode = 'edit')
{
$bid = intval($bid) ;
//HACK by domifara
Function update_block
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array())
{
global $xoopsConfig;
//HACK by domifara
- 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 renderCell4BlockPosition
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockPosition($block_data)
{
$bid = intval($block_data['bid']) ;
$side = intval($block_data['side']) ;
$visible = intval($block_data['visible']) ;
Method list_blocks
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function list_blocks()
{
global $xoopsGTicket ;
// main query
Method update_block
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array())
{
global $xoopsConfig;
//HACK by domifara
Function canClone
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function canClone($block)
{
// can clone link if it is marked as cloneable block
if ($block->getVar("block_type") == 'D' || $block->getVar("block_type") == 'C') {
return 2 ;
- 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 do_clone
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function do_clone($bid)
{
$bid = intval($bid) ;
$request = $this->fetchRequest4Block($bid) ;
Function form_edit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function form_edit($bid, $mode = 'edit')
{
$bid = intval($bid) ;
//HACK by domifara
- 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 init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init($xoopsModule)
{
// altsys "module" MODE
if ($xoopsModule->getVar('dirname') == 'altsys') {
// set target_module if specified by $_GET['dirname']
Method renderCell4BlockModuleLink
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockModuleLink($block_data)
{
$bid = intval($block_data['bid']) ;
// get selected targets
Function renderCell4BlockReadGroupPerm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockReadGroupPerm($block_data)
{
$bid = intval($block_data['bid']) ;
// get selected targets
- 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 do_clone
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function do_clone($bid)
{
$bid = intval($bid) ;
$request = $this->fetchRequest4Block($bid) ;
- 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 renderCell4BlockReadGroupPerm
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockReadGroupPerm($block_data)
{
$bid = intval($block_data['bid']) ;
// get selected targets
Method update_block
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array())
Method construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function construct()
{
$this->db =& XoopsDatabaseFactory::getDatabaseConnection() ;
$this->lang = @$GLOBALS['xoopsConfig']['language'] ;
Method list_groups
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function list_groups()
{
// query for getting blocks
$sql = "SELECT * FROM ".$this->db->prefix("newblocks")." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ;
$result = $this->db->query($sql) ;
Function renderCell4BlockModuleLink
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockModuleLink($block_data)
{
$bid = intval($block_data['bid']) ;
// get selected targets
- 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 renderCell4BlockPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockPosition($block_data)
{
$bid = intval($block_data['bid']) ;
$side = intval($block_data['side']) ;
$visible = intval($block_data['visible']) ;
- 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 processPost
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function processPost()
{
// Ticket Check
if (! $GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) {
redirect_header(XOOPS_URL.'/', 3, $GLOBALS['xoopsGTicket']->getErrors());
- 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 list_groups
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function list_groups()
{
// query for getting blocks
$sql = "SELECT * FROM ".$this->db->prefix("newblocks")." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ;
$result = $this->db->query($sql) ;
- 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 init
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function init($xoopsModule)
{
// altsys "module" MODE
if ($xoopsModule->getVar('dirname') == 'altsys') {
// set target_module if specified by $_GET['dirname']
- 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 list_blocks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function list_blocks()
{
global $xoopsGTicket ;
// main 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 do_edit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function do_edit($bid)
{
$bid = intval($bid) ;
if ($bid <= 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
return "
<div class='blockposition $scol0'>
<input type='radio' name='sides[$bid]' value='".XOOPS_SIDEBLOCK_LEFT."' class='blockposition' $ssel0 onclick='document.getElementById(\"extra_side_$bid\").value=".XOOPS_SIDEBLOCK_LEFT.";' />
</div>
<div style='float:"._GLOBAL_LEFT.";'>-</div>
- 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 190.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$block_data = $this->preview_request + array(
'bid' => $bid ,
'name' => $block->getVar('name', 'n') ,
'title' => $block->getVar('title', 'n') ,
'weight' => intval($block->getVar('weight')) ,
- 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 181.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
switch ($mode) {
case 'clone' :
$form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ;
$button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ;
$next_op = 'clone_ok' ;
- 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 180.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (! $is_custom && $block_template) {
// find template of the block
$tplfile_handler =& xoops_gethandler('tplfile');
$found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ;
$block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ;
- 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 96.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$block4assign = array(
'name_raw' => $block_data['name'] ,
'title_raw' => $block_data['title'] ,
'content_raw' => $block_data['content'] ,
'cell_position' => $this->renderCell4BlockPosition($block_data) ,
- 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 94.
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