imagecms/ImageCMS

View on GitHub
application/modules/CMSFactory/assetManager.php

Summary

Maintainability
D
1 day
Test Coverage

assetManager has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class assetManager
{

    /**
     * @var assetManager
Severity: Minor
Found in application/modules/CMSFactory/assetManager.php - About 4 hrs to fix

File assetManager.php has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace CMSFactory;

use CI;
Severity: Minor
Found in application/modules/CMSFactory/assetManager.php - About 3 hrs to fix

Function _render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function _render($tpl, $ignoreWrap = FALSE, $fetchJsTpl = TRUE, $admin = FALSE) {
        if (CI_Controller::get_instance()->input->is_ajax_request()) {
            $ignoreWrap = TRUE;
        }
        if (CI_Controller::get_instance()->input->post('ignoreWrap')) {
Severity: Minor
Found in application/modules/CMSFactory/assetManager.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 getModuleFilePath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function getModuleFilePath($files, $noExt = true) {

        if (is_string($files)) {
            $files = [$files];
        }
Severity: Minor
Found in application/modules/CMSFactory/assetManager.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

Method _render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function _render($tpl, $ignoreWrap = FALSE, $fetchJsTpl = TRUE, $admin = FALSE) {
        if (CI_Controller::get_instance()->input->is_ajax_request()) {
            $ignoreWrap = TRUE;
        }
        if (CI_Controller::get_instance()->input->post('ignoreWrap')) {
Severity: Minor
Found in application/modules/CMSFactory/assetManager.php - About 1 hr to fix

Function makePath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function makePath($path) {
        $path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
        $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
        $startSlash = strpos($path, '/') === 0 ? '/' : '';

Severity: Minor
Found in application/modules/CMSFactory/assetManager.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 registerStyle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function registerStyle($name, $useCompress = FALSE) {
        /** Start. Load file into template */

        $path = $this->buildStylePath($name);
        if ('' !== $path) {
Severity: Minor
Found in application/modules/CMSFactory/assetManager.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

Avoid too many return statements within this method.
Open

        return false;
Severity: Major
Found in application/modules/CMSFactory/assetManager.php - About 30 mins to fix

There are no issues that match your filters.

Category
Status