imagecms/ImageCMS

View on GitHub

Showing 1,388 of 1,858 total issues

File BannersI18n.php has 647 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace xbanners\models\Base;

use \Exception;
Severity: Major
Found in application/modules/xbanners/models/Base/BannersI18n.php - About 1 day to fix

File admin.php has 635 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use CMSFactory\assetManager;
use translator\classes\PoFileManager;
use translator\classes\FileOperator;
Severity: Major
Found in application/modules/translator/admin.php - About 1 day to fix

Function _get_real_tpl has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    private function _get_real_tpl($index = 0, $mode = 'item') {
        if ($mode == 'item') {
            $is_active = $this->arranged_menu_array[$index]['is_active'];
            $edge = $this->arranged_menu_array[$index]['edge'];

Severity: Minor
Found in application/modules/menu/menu.php - About 1 day to fix

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 display_menu has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    public function display_menu($menu_array) {

        $array_keys = array_keys($menu_array);
        $start_index = $array_keys[0];
        $end_index = $array_keys[count($array_keys) - 1];
Severity: Minor
Found in application/modules/menu/menu.php - About 1 day to fix

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_links has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

    public function create_links() {
        // If our item count or per-page total is zero there is no need to continue.
        if ($this->total_rows == 0 OR $this->per_page == 0) {
            return '';
        }
Severity: Minor
Found in application/libraries/MY_Pagination.php - About 1 day to fix

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

BannerImageI18n has 68 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class BannerImageI18n extends PropelBaseModelClass implements ActiveRecordInterface
{
    /**
     * TableMap class name
     */
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImageI18n.php - About 1 day to fix

Function create_item has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public function create_item($id = null) {

        if (!$this->input->post()) {
            $parents = $this->db
                ->where('menu_id', $id)
Severity: Minor
Found in application/modules/menu/admin.php - About 1 day to fix

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 prepare_menu_array has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare_menu_array($menu) {
        $menu_cache_key = $this->cache_key . $menu . self::getCurrentLocale();
        if (($menu_data = $this->cache->fetch($menu_cache_key, 'menus')) !== FALSE) {
            $this->menu_array = $menu_data['menu_array'];
            $this->sub_menu_array = $menu_data['sub_menu_array'];
Severity: Minor
Found in application/modules/menu/menu.php - About 1 day to fix

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_captcha has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '') {
        /**
         * Function to create a random color
         * Note: We aren't using this outside this function so we will sit it inside
         * @auteur mastercode.nl
Severity: Minor
Found in application/helpers/dx_captcha_helper.php - About 1 day to fix

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 findLangs has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    public function findLangs($dir = '') {

        if (!in_array($dir, self::$PARSED_PATHS)) {
            $baseDir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
            foreach ($baseDir as $file) {
Severity: Minor
Found in application/modules/translator/classes/FilesParser.php - About 1 day to fix

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

File Export.php has 550 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Клас призначений для експорту даних в файл форматів: csv,xlsx,xls.
 * Також передбачена можливість вигрузки основних та додаткових зображень в ZIP-архів
Severity: Major
Found in application/modules/import_export/classes/Export.php - About 1 day to fix

File exchange.php has 550 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

(defined('BASEPATH')) or exit('No direct script access allowed');

use CMSFactory\ModuleSettings;
Severity: Major
Found in application/modules/exchange/exchange.php - About 1 day to fix

File categories.php has 548 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use CMSFactory\Events;
use core\models\Route;
use core\models\RouteQuery;
Severity: Major
Found in application/modules/admin/categories.php - About 1 day to fix

BannersI18n has 62 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class BannersI18n extends PropelBaseModelClass implements ActiveRecordInterface
{
    /**
     * TableMap class name
     */
Severity: Major
Found in application/modules/xbanners/models/Base/BannersI18n.php - About 1 day to fix

File PoFileManager.php has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace translator\classes;

use Gettext\Translations;
Severity: Major
Found in application/modules/translator/classes/PoFileManager.php - About 1 day to fix

File commentsapi.php has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use core\models\Route;
use core\src\CoreFactory;
use CMSFactory\Events;
Severity: Major
Found in application/modules/comments/commentsapi.php - About 1 day to fix

Function execute has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute($where = [], $offset = 0) {
        $collect_ids = FALSE;

        if ($this->table == '') {
            $error = lang('Error. Select or specify the table for search', 'search');
Severity: Minor
Found in application/modules/search/search.php - About 1 day to fix

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

File wishlist_model.php has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use cmsemail\email;
use CMSFactory\ModuleSettings;
use core\models\Route;

Severity: Major
Found in application/modules/wishlist/models/wishlist_model.php - About 1 day to fix

Function initDiscounts has 214 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function initDiscounts() {

                var isGift = $('#gift_checkbox').attr('checked') == 'checked';
                if (isGift) {
                    giftCheckboxCallback();
Severity: Major
Found in application/modules/mod_discount/assets/js/adminScripts.js - About 1 day to fix

File comments.php has 521 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use CMSFactory\assetManager;

if (!defined('BASEPATH')) {
Severity: Major
Found in application/modules/comments/comments.php - About 1 day to fix
Severity
Category
Status
Source
Language