imagecms/ImageCMS

View on GitHub
application/modules/template_manager/admin.php

Summary

Maintainability
D
1 day
Test Coverage

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

<?php

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

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

Method index has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function index() {
        if ($this->input->post()) {
            try {
                switch ($this->input->post('action')) {
                    // Upload template from pc or url
Severity: Major
Found in application/modules/template_manager/admin.php - About 2 hrs to fix

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

    public function deleteTemplate($templateName) {
        // Template directory path
        $dir = TEMPLATES_PATH . $templateName;
        $delete = TRUE;

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

    public function index() {
        if ($this->input->post()) {
            try {
                switch ($this->input->post('action')) {
                    // Upload template from pc or url
Severity: Minor
Found in application/modules/template_manager/admin.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 deleteTemplate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function deleteTemplate($templateName) {
        // Template directory path
        $dir = TEMPLATES_PATH . $templateName;
        $delete = TRUE;

Severity: Minor
Found in application/modules/template_manager/admin.php - About 1 hr to fix

Function setLogoFav has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function setLogoFav() {

        $this->load->library('SiteInfo');
        $imagesPath = PUBPATH . $this->siteinfo->imagesPath;

Severity: Minor
Found in application/modules/template_manager/admin.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 setLogoFav has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function setLogoFav() {

        $this->load->library('SiteInfo');
        $imagesPath = PUBPATH . $this->siteinfo->imagesPath;

Severity: Minor
Found in application/modules/template_manager/admin.php - About 1 hr to fix

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

    private function uploadByUrl($url, $content = '') {
        if (!$content) {
            $ext = pathinfo($url, PATHINFO_EXTENSION);
            if ($ext != 'zip') {
                throw new Exception(lang('Wrong file type', 'template_manager'));
Severity: Minor
Found in application/modules/template_manager/admin.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 getRemoteTemplate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRemoteTemplate($templateId = NULL) {
        if ($templateId) {
            $template_content = file_get_contents(self::REMOTE_TEMPLATES_REPOSITORY . $templateId);
            if ($template_content) {

Severity: Minor
Found in application/modules/template_manager/admin.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

There are no issues that match your filters.

Category
Status