File components.php
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use CMSFactory\Events;
if (!defined('BASEPATH')) {
- Create a ticketCreate a ticket
Components
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Components extends BaseAdminController
{
/**
* array of installed modules
- Create a ticketCreate a ticket
Method modules_table
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function modules_table() {
$not_installed = [];
$fs_modules = $this->find_components();
$db_modules = $this->db->order_by('position', 'asc')->not_like('identif', 'payment_method_')->get('components')->result_array();
- Create a ticketCreate a ticket
Function find_components
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function find_components($in_menu = FALSE) {
$components = [];
if ($in_menu == TRUE) {
$this->db->where('in_menu', 1);
}
- Read upRead up
- Create a ticketCreate a ticket
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 find_components_for_menu_list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function find_components_for_menu_list() {
/** Get all components which show in menu */
$components = $this->db->where('in_menu', 1);
if (MAINSITE) {
- Read upRead up
- Create a ticketCreate a ticket
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 deinstall
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function deinstall($moduleName) {
$modules = $this->input->post('ids') ?: [$moduleName];
foreach ($modules as $module) {
$module = strtolower($module);
- Read upRead up
- Create a ticketCreate a ticket
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 find_components
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find_components($in_menu = FALSE) {
$components = [];
if ($in_menu == TRUE) {
$this->db->where('in_menu', 1);
}
- Create a ticketCreate a ticket
Function modules_table
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function modules_table() {
$not_installed = [];
$fs_modules = $this->find_components();
$db_modules = $this->db->order_by('position', 'asc')->not_like('identif', 'payment_method_')->get('components')->result_array();
- Read upRead up
- Create a ticketCreate a ticket
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 install
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function install($module = '') {
//cp_check_perm('module_install');
$module = strtolower($module);
- Read upRead up
- Create a ticketCreate a ticket
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 install
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install($module = '') {
//cp_check_perm('module_install');
$module = strtolower($module);
- Create a ticketCreate a ticket
Method find_components_for_menu_list
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find_components_for_menu_list() {
/** Get all components which show in menu */
$components = $this->db->where('in_menu', 1);
if (MAINSITE) {
- Create a ticketCreate a ticket
Method deinstall
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deinstall($moduleName) {
$modules = $this->input->post('ids') ?: [$moduleName];
foreach ($modules as $module) {
$module = strtolower($module);
- Create a ticketCreate a ticket
Function save_components_positions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function save_components_positions() {
$positions = $this->input->post('positions');
if (is_array($positions)) {
foreach ($positions as $key => $value) {
if ($this->db->where('name', $value)->set('position', $key)->update('components')) {
- Read upRead up
- Create a ticketCreate a ticket
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 change_autoload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function change_autoload() {
if ($this->input->post('mid')) {
$mid = $this->input->post('mid');
$row = $this->db->where('id', $mid)->get('components')->row();
if (count($row) > 0) {
- Read upRead up
- Create a ticketCreate a ticket
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 change_url_access
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function change_url_access() {
if ($this->input->post('mid')) {
$mid = $this->input->post('mid');
$row = $this->db->where('id', $mid)->get('components')->row();
- Read upRead up
- Create a ticketCreate a ticket
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 isPermitedModules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function isPermitedModules($db_modules, $not_installed) {
foreach ($db_modules as $key => $db_module) {
if ($this->isNotPermited($db_module['name'])) {
unset($db_modules[$key]);
}
- Read upRead up
- Create a ticketCreate a ticket
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"