File MyBlocksAdmin.class.php
has 772 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Altsys library (UI-Components) Admin blocks and permissions
* Class MyBlocksAdmin
* @package Altsys
Method form_edit
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form_edit( $bid, $mode = 'edit' ) {
$bid = (int) $bid;
//HACK by domifara
if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
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 = [] ) {
global $xoopsConfig;
//HACK by domifara
if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
- 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
MyBlocksAdmin
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class MyBlocksAdmin {
public $db;
public $lang;
Method renderCell4BlockPosition
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockPosition( $block_data ) {
$bid = (int) $block_data['bid'];
$side = (int) $block_data['side'];
$visible = (int) $block_data['visible'];
Method list_blocks
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function list_blocks() {
global $xoopsGTicket;
// main query
$sql = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
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 = [] ) {
global $xoopsConfig;
//HACK by domifara
if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
Method do_clone
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function do_clone( $bid ) {
$bid = (int) $bid;
$request = $this->fetchRequest4Block( $bid );
Function form_edit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function form_edit( $bid, $mode = 'edit' ) {
$bid = (int) $bid;
//HACK by domifara
if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init( $xoopsModule ) {
// altsys "module" MODE
if ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) {
// set target_module if specified by $_GET['dirname']
Function do_clone
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function do_clone( $bid ) {
$bid = (int) $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
Function canClone
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function canClone( $block ) {
// can clone link if it is marked as cloneable block
if ( 'D' == $block->getVar( 'block_type' ) || 'C' == $block->getVar( 'block_type' ) ) {
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
Function renderCell4BlockReadGroupPerm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockReadGroupPerm( $block_data ) {
$bid = (int) $block_data['bid'];
// get selected targets
if ( is_array( @$block_data['bgroup'] ) ) {
- 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 update_block
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function update_block( $bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = [] ) {
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 );
$block_arr = [];
Method renderCell4BlockModuleLink
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockModuleLink( $block_data ) {
$bid = (int) $block_data['bid'];
// get selected targets
if ( is_array( @$block_data['bmodule'] ) ) {
Function renderCell4BlockModuleLink
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockModuleLink( $block_data ) {
$bid = (int) $block_data['bid'];
// get selected targets
if ( is_array( @$block_data['bmodule'] ) ) {
- 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 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderCell4BlockReadGroupPerm( $block_data ) {
$bid = (int) $block_data['bid'];
// get selected targets
if ( is_array( @$block_data['bgroup'] ) ) {
Function renderCell4BlockPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function renderCell4BlockPosition( $block_data ) {
$bid = (int) $block_data['bid'];
$side = (int) $block_data['side'];
$visible = (int) $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 );
$block_arr = [];
- 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 ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) {
// 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
$sql = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
- 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 = (int) $bid;
if ( $bid <= 0 ) {
// new custom block
- 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"