imagecms/ImageCMS

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

Summary

Maintainability
F
6 days
Test Coverage

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

<?php

use CMSFactory\assetManager;
use translator\classes\PoFileManager;
use translator\classes\FileOperator;
Severity: Major
Found in application/modules/translator/admin.php - About 1 day to fix

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

    public function parse($module_template, $type, $lang) {

        $url_base = dirname($this->poFileManager->getPoFileUrl($module_template, $type, $lang));
        $url = get_mainsite_url($url_base);

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

    private function updateJsLangsFile($langs, $domain, $type) {

        if ($type == 'modules') {
            if (MAINSITE && !is_client_module($domain)) {
                return FALSE;
Severity: Minor
Found in application/modules/translator/admin.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

Admin has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class Admin extends BaseAdminController
{

    private static $BILING;

Severity: Minor
Found in application/modules/translator/admin.php - About 3 hrs to fix

Function makeCorrectPoPaths has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeCorrectPoPaths($module_template, $type, $lang, $returnArray = FALSE) {

        $url = dirname($this->poFileManager->getPoFileUrl($module_template, $type, $lang));
        //______________________________________________________
        $url = get_mainsite_url($url);
Severity: Minor
Found in application/modules/translator/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 createFile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function createFile($module_template, $type, $lang) {

        if ($this->input->post()) {
            $lang = $this->input->post('locale');
            $type = $this->input->post('type');
Severity: Minor
Found in application/modules/translator/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 search has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function search($search = NULL, $searchType = NULL) {

        $data = $this->input->post();
        $search = $search ?: trim($data['search']);
        $search = urldecode($search);
Severity: Minor
Found in application/modules/translator/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 translate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function translate() {

        $po_array = (array) json_decode($this->input->post('po_array'));
        $result = (array) json_decode($this->input->post('results'));
        $withEmptyTranslation = $this->input->post('withEmptyTranslation');
Severity: Minor
Found in application/modules/translator/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 parse has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse($module_template, $type, $lang) {

        $url_base = dirname($this->poFileManager->getPoFileUrl($module_template, $type, $lang));
        $url = get_mainsite_url($url_base);

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

Method search has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function search($search = NULL, $searchType = NULL) {

        $data = $this->input->post();
        $search = $search ?: trim($data['search']);
        $search = urldecode($search);
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

Method makeCorrectPoPaths has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function makeCorrectPoPaths($module_template, $type, $lang, $returnArray = FALSE) {

        $url = dirname($this->poFileManager->getPoFileUrl($module_template, $type, $lang));
        //______________________________________________________
        $url = get_mainsite_url($url);
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

Method createFile has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createFile($module_template, $type, $lang) {

        if ($this->input->post()) {
            $lang = $this->input->post('locale');
            $type = $this->input->post('type');
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

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

    public function index($isExchange = FALSE) {

        $translation = $this->session->userdata('translation');

        $po_table = '';
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

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

    public function exchangeTranslation() {

        if ($this->input->post()) {
            $langExchanger = $this->input->post('langExchanger');
            $langReceiver = $this->input->post('langReceiver');
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

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

    public function exchangeTranslation() {

        if ($this->input->post()) {
            $langExchanger = $this->input->post('langExchanger');
            $langReceiver = $this->input->post('langReceiver');
Severity: Minor
Found in application/modules/translator/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 updateJsLangsFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function updateJsLangsFile($langs, $domain, $type) {

        if ($type == 'modules') {
            if (MAINSITE && !is_client_module($domain)) {
                return FALSE;
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

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

    public function index($isExchange = FALSE) {

        $translation = $this->session->userdata('translation');

        $po_table = '';
Severity: Minor
Found in application/modules/translator/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 translate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function translate() {

        $po_array = (array) json_decode($this->input->post('po_array'));
        $result = (array) json_decode($this->input->post('results'));
        $withEmptyTranslation = $this->input->post('withEmptyTranslation');
Severity: Minor
Found in application/modules/translator/admin.php - About 1 hr to fix

Method renderModulePoFile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderModulePoFile($module_template, $type, $lang) {

        $this->session->unset_userdata('translation');
        $url = $this->poFileManager->getPoFileUrl($module_template, $type, $lang);

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

Method update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update($module_template, $type, $lang) {

        $strings = (array) json_decode($this->input->post('results'));
        $translations = $this->makeCorrectPoPaths($module_template, $type, $lang, TRUE);

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

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

    public function renderModulePoFile($module_template, $type, $lang) {

        $this->session->unset_userdata('translation');
        $url = $this->poFileManager->getPoFileUrl($module_template, $type, $lang);

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

    public function updateOne() {

        $name = $this->input->post('name');
        $type = $this->input->post('type');
        $locale = $this->input->post('locale');
Severity: Minor
Found in application/modules/translator/admin.php - About 25 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 renderModulesNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderModulesNames($lang) {

        $langs = $this->session->userdata('langs_modules');
        $langs = $langs[$lang];
        $langs = sort_names($langs);
Severity: Minor
Found in application/modules/translator/admin.php - About 25 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 savePoArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function savePoArray($module_template, $type, $lang) {

        $po_array = (array) json_decode($this->input->post('po_array'));
        $showMessage = (bool) $this->input->post('showMessage');

Severity: Minor
Found in application/modules/translator/admin.php - About 25 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