imagecms/ImageCMS

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

Summary

Maintainability
D
2 days
Test Coverage

File settings.php has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use template_manager\classes\Template;

if (!defined('BASEPATH')) {
Severity: Minor
Found in application/modules/admin/settings.php - About 4 hrs to fix

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

    public function index() {

        $settings = $this->cms_admin->get_settings();
        unset($settings['siteinfo']);

Severity: Major
Found in application/modules/admin/settings.php - About 4 hrs to fix

Method save has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save() {
        //cp_check_perm('cp_site_settings');

        $this->form_validation->set_rules('siteinfo_adminemail', lang('Admin email', 'admin'), 'trim|valid_email');
        if (!$this->form_validation->run($this)) {
Severity: Major
Found in application/modules/admin/settings.php - About 2 hrs to fix

Function processSiteInfo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processSiteInfo() {

        $this->load->library('SiteInfo', $this->input->post('siteinfo_locale'));

        // getting all parameters with keys
Severity: Minor
Found in application/modules/admin/settings.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 processSiteInfo has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function processSiteInfo() {

        $this->load->library('SiteInfo', $this->input->post('siteinfo_locale'));

        // getting all parameters with keys
Severity: Major
Found in application/modules/admin/settings.php - About 2 hrs to fix

Method translate_meta has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function translate_meta() {

        $this->load->library('form_validation');

        $this->form_validation->set_rules('name', lang('Name', 'admin'), 'trim|required|xss_clean');
Severity: Minor
Found in application/modules/admin/settings.php - About 1 hr to fix

Function save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function save() {
        //cp_check_perm('cp_site_settings');

        $this->form_validation->set_rules('siteinfo_adminemail', lang('Admin email', 'admin'), 'trim|valid_email');
        if (!$this->form_validation->run($this)) {
Severity: Minor
Found in application/modules/admin/settings.php - About 55 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