Function build_cats_tree
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function build_cats_tree($cats, $selected_cats = []) {
if (is_array($cats)) {
foreach ($cats as $cat) {
echo '<option';
- 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 get_templates
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function get_templates() {
$new_arr_shop = [];
if ($handle = opendir(TEMPLATES_PATH)) {
while (false !== ($file = readdir($handle))) {
- 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 create_language_select
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function create_language_select($languages, $locale, $url, $pjax = FALSE) {
if (count($languages) > 1 && \MY_Controller::isPremiumCMS()) {
$html = "<div class='dropdown d-i_b'>";
foreach ($languages as $language) {
- 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 build_cats_tree_ul_li
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function build_cats_tree_ul_li($cats, $item_id = NULL, $level = 0) {
if (is_array($cats)) {
$subst = '';
if ($level !== 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 create_admin_language_select
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function create_admin_language_select() {
$CI = &get_instance();
$languages = $CI->db->select('lang_name, locale')->order_by('lang_name')->get('languages')->result_array();
$current_locale = $CI->config->item('language');
- 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_admin_language_select
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create_admin_language_select() {
$CI = &get_instance();
$languages = $CI->db->select('lang_name, locale')->order_by('lang_name')->get('languages')->result_array();
$current_locale = $CI->config->item('language');
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!is_file(TEMPLATES_PATH . $file)) {
if (is_dir(TEMPLATES_PATH . $file . '/shop/')) {
$new_arr_shop[$file] = $file;
} else {
$new_arr[$file] = $file;
- Create a ticketCreate a ticket