File widgets_manager.php
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use CMSFactory\Events;
use translator\classes\Replacer;
- Create a ticketCreate a ticket
Function create
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function create() {
if (!$this->_is_writable()) {
showMessage(lang('Set the directory access rights to continue the work with widgets', 'admin') . '<b>' . $this->widgets_path . '</b>', '', 'r');
exit;
}
- 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 create
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create() {
if (!$this->_is_writable()) {
showMessage(lang('Set the directory access rights to continue the work with widgets', 'admin') . '<b>' . $this->widgets_path . '</b>', '', 'r');
exit;
}
- Create a ticketCreate a ticket
Function update_widget
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function update_widget($id, $update_info = FALSE, $locale = NULL) {
//cp_check_perm('widget_access_settings');
$locale = $locale ?: MY_Controller::defaultLocale();
$widget = $this->get($id);
- 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 update_widget
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_widget($id, $update_info = FALSE, $locale = NULL) {
//cp_check_perm('widget_access_settings');
$locale = $locale ?: MY_Controller::defaultLocale();
$widget = $this->get($id);
- Create a ticketCreate a ticket
Method update_html_widget
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_html_widget($id, $locale) {
$locale = $locale ?: MY_Controller::defaultLocale();
$widget = $this->get($id);
if ($widget->num_rows() == 1) {
$widget = $widget->row_array();
- Create a ticketCreate a ticket
Method display_create_tpl
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display_create_tpl($type = FALSE) {
if ($type == 'tmodule') {
$case = true;
$type = 'module';
}
- Create a ticketCreate a ticket
Function display_create_tpl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function display_create_tpl($type = FALSE) {
if ($type == 'tmodule') {
$case = true;
$type = '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
Function index
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function index() {
if (!$this->_is_writable()) {
$this->template->assign('error', lang('Set the directory access rights to continue the work with widgets', 'admin') . '<b>' . $this->widgets_path . '</b>');
$this->template->show('widgets_list', FALSE);
- 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 index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index() {
if (!$this->_is_writable()) {
$this->template->assign('error', lang('Set the directory access rights to continue the work with widgets', 'admin') . '<b>' . $this->widgets_path . '</b>');
$this->template->show('widgets_list', FALSE);
- Create a ticketCreate a ticket
Function update_html_widget
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function update_html_widget($id, $locale) {
$locale = $locale ?: MY_Controller::defaultLocale();
$widget = $this->get($id);
if ($widget->num_rows() == 1) {
$widget = $widget->row_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
Method edit_module_widget
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit_module_widget($id, $update_info = FALSE, $locale = NULL) {
//cp_check_perm('widget_access_settings');
$locale = $locale ?: MY_Controller::defaultLocale();
if ($this->input->post()) {
- Create a ticketCreate a ticket
Function getWidgetsArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getWidgetsArray($pathToFile) {
include_once $pathToFile;
/* @var $widgets array - Widget settings array */
if ($widgets) {
- 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"