imagecms/ImageCMS

View on GitHub
application/libraries/template.php

Summary

Maintainability
D
1 day
Test Coverage

Function splitTplFiles has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function splitTplFiles($tpl) {
        if (false === strpos($tpl, '</html>')) {
            return $tpl;
        }

Severity: Minor
Found in application/libraries/template.php - About 3 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

Template has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Template extends Mabilis
{

    protected $main_layout = 'main';

Severity: Minor
Found in application/libraries/template.php - About 3 hrs to fix

File template.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
Severity: Minor
Found in application/libraries/template.php - About 2 hrs to fix

Method splitTplFiles has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function splitTplFiles($tpl) {
        if (false === strpos($tpl, '</html>')) {
            return $tpl;
        }

Severity: Major
Found in application/libraries/template.php - About 2 hrs to fix

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

    protected function split($data) {
        $count = count($data);
        if ($count > 0) {
            foreach ($data as $str => $pos) {
                /** @noinspection NotOptimalIfConditionsInspection */
Severity: Minor
Found in application/libraries/template.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 load has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function load() {
        $this->CI = &get_instance();
        $this->modules_template_dir = TEMPLATES_PATH . 'modules/';
        $tpl = $this->CI->config->item('template');

Severity: Minor
Found in application/libraries/template.php - About 1 hr to fix

There are no issues that match your filters.

Category
Status