imagecms/ImageCMS

View on GitHub
application/modules/exchange/exchange.php

Summary

Maintainability
F
5 days
Test Coverage

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

Function command_sale_import has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    private function command_sale_import() {

        if ($this->check_perm() != true) {
            exit();
        }
Severity: Minor
Found in application/modules/exchange/exchange.php - About 6 hrs 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

Method command_sale_query has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function command_sale_query() {

        $xml_order = '';

        if ($this->check_perm() === true) {
Severity: Major
Found in application/modules/exchange/exchange.php - About 5 hrs to fix

Function command_catalog_file has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    private function command_catalog_file() {

        if ($this->check_perm() === true) {
            $file_info = pathinfo($this->input->get('filename'));
            $file_extension = $file_info['extension'];
Severity: Minor
Found in application/modules/exchange/exchange.php - About 4 hrs 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 command_catalog_import has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function command_catalog_import() {

        if ($this->check_perm() === true) {
            if ($this->my_config['backup']) {
                $this->makeDBBackup();
Severity: Minor
Found in application/modules/exchange/exchange.php - About 2 hrs 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

Exchange has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Exchange extends \MY_Controller
{

    /**
     * array which contains 1c settings
Severity: Minor
Found in application/modules/exchange/exchange.php - About 2 hrs to fix

Function command_sale_query has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function command_sale_query() {

        $xml_order = '';

        if ($this->check_perm() === true) {
Severity: Minor
Found in application/modules/exchange/exchange.php - About 2 hrs 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

Method command_catalog_file has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function command_catalog_file() {

        if ($this->check_perm() === true) {
            $file_info = pathinfo($this->input->get('filename'));
            $file_extension = $file_info['extension'];
Severity: Major
Found in application/modules/exchange/exchange.php - About 2 hrs to fix

Method __construct has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct() {

        parent::__construct();

        $this->time = time();
Severity: Major
Found in application/modules/exchange/exchange.php - About 2 hrs to fix

Method command_catalog_import has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function command_catalog_import() {

        if ($this->check_perm() === true) {
            if ($this->my_config['backup']) {
                $this->makeDBBackup();
Severity: Minor
Found in application/modules/exchange/exchange.php - About 1 hr to fix

Method command_sale_import has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function command_sale_import() {

        if ($this->check_perm() != true) {
            exit();
        }
Severity: Minor
Found in application/modules/exchange/exchange.php - About 1 hr to fix

Method _install has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _install() {

        $this->load->dbforge();
        ($this->dx_auth->is_admin()) or exit;
        $fields = [
Severity: Minor
Found in application/modules/exchange/exchange.php - About 1 hr to fix

Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct() {

        parent::__construct();

        $this->time = time();
Severity: Minor
Found in application/modules/exchange/exchange.php - About 45 mins 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 error_log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function error_log($error, $send_email = false) {

        $intIp = $_SERVER['REMOTE_ADDR'];
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            if (isset($_SERVER['HTTP_X_REAL_IP'])) {
Severity: Minor
Found in application/modules/exchange/exchange.php - About 25 mins 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

There are no issues that match your filters.

Category
Status