imagecms/ImageCMS

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

Summary

Maintainability
F
3 days
Test Coverage

Function renameLocaleFolders has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    private function renameLocaleFolders($from_locale, $to_locale) {

        if ($from_locale && $to_locale) {
            $templates_dir = './templates';
            $main_dir = './application/language/main';
Severity: Minor
Found in application/modules/admin/languages.php - About 5 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

File languages.php has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

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

Function createLanguageFolders has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function createLanguageFolders($lang) {

        $templates_dir = './templates';
        $main_dir = './application/language/main';
        $modules_dir = './application/modules';
Severity: Minor
Found in application/modules/admin/languages.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

Function deleteLanguageFolders has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function deleteLanguageFolders($lang) {

        $templates_dir = './templates';
        $main_dir = './application/language/main';
        $modules_dir = './application/modules';
Severity: Minor
Found in application/modules/admin/languages.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

Method getPoFileSettingsText has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getPoFileSettingsText($lang = '', $type = '', $module = NULL) {

        $content = b"\xEF\xBB\xBF" .
            'msgid ""' . PHP_EOL .
            'msgstr ""' . PHP_EOL .
Severity: Major
Found in application/modules/admin/languages.php - About 2 hrs to fix

Function getPoFileSettingsText has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPoFileSettingsText($lang = '', $type = '', $module = NULL) {

        $content = b"\xEF\xBB\xBF" .
            'msgid ""' . PHP_EOL .
            'msgstr ""' . PHP_EOL .
Severity: Minor
Found in application/modules/admin/languages.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 renameLocaleFolders has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function renameLocaleFolders($from_locale, $to_locale) {

        if ($from_locale && $to_locale) {
            $templates_dir = './templates';
            $main_dir = './application/language/main';
Severity: Minor
Found in application/modules/admin/languages.php - About 1 hr to fix

Method createLanguageFolders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createLanguageFolders($lang) {

        $templates_dir = './templates';
        $main_dir = './application/language/main';
        $modules_dir = './application/modules';
Severity: Minor
Found in application/modules/admin/languages.php - About 1 hr to fix

Function _get_lang_folders has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function _get_lang_folders() {

        $new_arr = [];

        if ($handle = opendir(APPPATH . 'language/')) {
Severity: Minor
Found in application/modules/admin/languages.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 delete has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function delete() {

        //cp_check_perm('lang_delete');
        //$id = $this->input->post('lang_id');
        $id = $this->input->post('ids');
Severity: Minor
Found in application/modules/admin/languages.php - About 1 hr to fix

Method deleteLanguageFolders has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function deleteLanguageFolders($lang) {

        $templates_dir = './templates';
        $main_dir = './application/language/main';
        $modules_dir = './application/modules';
Severity: Minor
Found in application/modules/admin/languages.php - About 1 hr to fix

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

    public function delete() {

        //cp_check_perm('lang_delete');
        //$id = $this->input->post('lang_id');
        $id = $this->input->post('ids');
Severity: Minor
Found in application/modules/admin/languages.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

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

    public function update($lang_id) {

        //cp_check_perm('lang_edit');

        $this->form_validation->set_rules('lang_name', lang('Language', 'admin'), 'trim|required|min_length[1]|max_length[100]');
Severity: Minor
Found in application/modules/admin/languages.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

There are no issues that match your filters.

Category
Status