plugins/locale/admin_modules/yf_locale_editor.class.php

Summary

Maintainability
F
5 days
Test Coverage

File yf_locale_editor.class.php has 752 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Locale, i18n (Internationalization) editor.
 *
Severity: Major
Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 day to fix

    yf_locale_editor has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_locale_editor
    {
        /** @var array @conf_skip */
        private static $HELP = [
            'edit' => [
    Severity: Minor
    Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 5 hrs to fix

      Method var_edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function var_edit()
          {
              $a = $this->_get_var_info($_GET['id']);
              if ( ! $a) {
                  return _e('Wrong var id');
      Severity: Major
      Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 2 hrs to fix

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

            public function vars()
            {
                $vars = $this->_get_all_vars_from_files();
                $vars_db = $this->_get_all_vars_from_db();
                foreach ((array) $vars_db as $source => $a) {
        Severity: Minor
        Found in plugins/locale/admin_modules/yf_locale_editor.class.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 vars has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function vars()
            {
                $vars = $this->_get_all_vars_from_files();
                $vars_db = $this->_get_all_vars_from_db();
                foreach ((array) $vars_db as $source => $a) {
        Severity: Major
        Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 2 hrs to fix

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

              public function var_edit()
              {
                  $a = $this->_get_var_info($_GET['id']);
                  if ( ! $a) {
                      return _e('Wrong var id');
          Severity: Minor
          Found in plugins/locale/admin_modules/yf_locale_editor.class.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 show has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function show()
              {
                  $all_vars = $this->_get_all_vars();
                  $total_vars = count((array) $all_vars);
                  $tr_vars = [];
          Severity: Minor
          Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

            Function show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function show()
                {
                    $all_vars = $this->_get_all_vars();
                    $total_vars = count((array) $all_vars);
                    $tr_vars = [];
            Severity: Minor
            Found in plugins/locale/admin_modules/yf_locale_editor.class.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 _preload_data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _preload_data()
                {
                    if ($this->_preload_complete) {
                        return true;
                    }
            Severity: Minor
            Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

              Method _show_files_for_lang has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _show_files_for_lang($lang, $lang_files, $var_files)
                  {
                      $yf_path_len = strlen(YF_PATH);
                      $app_path_len = strlen(APP_PATH);
              
              
              Severity: Minor
              Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

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

                    public function _get_vars_from_files($lang)
                    {
                        $files = [];
                        // Auto-find shared language vars. They will be connected in order of file system
                        // Names can be any, but better to include lang name into file name. Examples:
                Severity: Minor
                Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

                  Function _get_var_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _get_var_info($id)
                      {
                          $id = trim($id);
                          if ( ! strlen($id)) {
                              return [];
                  Severity: Minor
                  Found in plugins/locale/admin_modules/yf_locale_editor.class.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

                  Function _get_vars_from_files has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _get_vars_from_files($lang)
                      {
                          $files = [];
                          // Auto-find shared language vars. They will be connected in order of file system
                          // Names can be any, but better to include lang name into file name. Examples:
                  Severity: Minor
                  Found in plugins/locale/admin_modules/yf_locale_editor.class.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 files has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function files()
                      {
                          $self_page_css = 'body.get-object-' . $_GET['object'];
                          css('
                              ' . $self_page_css . ' li.li-header { list-style: none; display:none; }
                  Severity: Minor
                  Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

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

                        public function _get_all_vars_from_files()
                        {
                            $vars = [];
                            foreach ((array) $this->_cur_langs as $lang => $lang_name) {
                                list($lang_vars, $var_files) = $this->_get_vars_from_files($lang);
                    Severity: Minor
                    Found in plugins/locale/admin_modules/yf_locale_editor.class.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 sources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sources()
                        {
                            $vars = $this->_get_all_vars_from_db();
                            $files = [];
                            foreach ((array) $vars as $source => $a) {
                    Severity: Minor
                    Found in plugins/locale/admin_modules/yf_locale_editor.class.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