imagecms/ImageCMS

View on GitHub
application/libraries/Update.php

Summary

Maintainability
C
7 hrs
Test Coverage

File Update.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use libraries\Backup;

/**
Severity: Minor
Found in application/libraries/Update.php - About 2 hrs to fix

Function restore_files_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function restore_files_list() {

        if (is_readable(BACKUPFOLDER)) {
            $dh = opendir(BACKUPFOLDER);
            while ($filename = readdir($dh)) {
Severity: Minor
Found in application/libraries/Update.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

Function parse_md5 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse_md5($directory = null) {

        $dir = null === $directory ? realpath('') : $directory;

        $handle = opendir($dir);
Severity: Minor
Found in application/libraries/Update.php - About 1 hr 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 add_to_ZIP has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function add_to_ZIP($files = []) {

        if (empty($files)) {
            throw new Exception(lang('Nothing to create', 'admin'));
        }
Severity: Minor
Found in application/libraries/Update.php - About 35 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 query_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function query_from_file($file) {

        $string_query = rtrim($file, "\n;");
        $array_query = explode(";\n", $string_query);

Severity: Minor
Found in application/libraries/Update.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