imagecms/ImageCMS

View on GitHub

Showing 1,858 of 1,858 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

     public static function doDelete($values, ConnectionInterface $con = null)
     {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME);
        }
application/modules/xbanners/models/Map/BannerImageI18nTableMap.php on lines 429..467

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 285.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

     public static function doDelete($values, ConnectionInterface $con = null)
     {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getWriteConnection(BannerImageI18nTableMap::DATABASE_NAME);
        }
application/modules/xbanners/models/Map/BannersI18nTableMap.php on lines 405..443

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 285.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public function import($filePath) {
        $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
        if ($ext != 'php' && $ext != '') {
            return;
        }
Severity: Major
Found in application/modules/mod_stats/mod_stats.php and 1 other location - About 1 day to fix
application/modules/mod_stats/controllers/UsersController.php on lines 223..244

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 284.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public function import($filePath) {
        $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
        if ($ext != 'php' && $ext != '') {
            return;
        }
application/modules/mod_stats/mod_stats.php on lines 140..161

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 284.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    public function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    public function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_liqpay/payment_method_liqpay.php on lines 207..244
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 279.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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
Severity
Category
Status
Source
Language