plugins/sys/admin_modules/yf_menus_editor.class.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php

/**
 * System-wide menus editor.
 *
Severity: Major
Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 1 day to fix

    Function _show_menu has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _show_menu($input = [])
        {
            $RETURN_ARRAY = isset($input['return_array']) ? $input['return_array'] : false;
            $force_stpl_name = isset($input['force_stpl_name']) ? $input['force_stpl_name'] : false;
            $menu_name = $input['name'];
    Severity: Minor
    Found in plugins/sys/admin_modules/yf_menus_editor.class.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

    Method _show_menu has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _show_menu($input = [])
        {
            $RETURN_ARRAY = isset($input['return_array']) ? $input['return_array'] : false;
            $force_stpl_name = isset($input['force_stpl_name']) ? $input['force_stpl_name'] : false;
            $menu_name = $input['name'];
    Severity: Major
    Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 4 hrs to fix

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

      class yf_menus_editor
      {
          /** @var string Path to icons */
          public $ICONS_PATH = 'uploads/icons/';
      
      
      Severity: Minor
      Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 3 hrs to fix

        Function drag_items has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function drag_items()
            {
                if (empty($_GET['id'])) {
                    return _e('No id!');
                }
        Severity: Minor
        Found in plugins/sys/admin_modules/yf_menus_editor.class.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 drag_items has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function drag_items()
            {
                if (empty($_GET['id'])) {
                    return _e('No id!');
                }
        Severity: Major
        Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 2 hrs to fix

          Method edit_item has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function edit_item()
              {
                  $item_info = db()->query_fetch('SELECT * FROM ' . db('menu_items') . ' WHERE id=' . (int) ($_GET['id']));
                  if (empty($item_info['id'])) {
                      return _e('No such menu item!');
          Severity: Minor
          Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 2 hrs to fix

            Method add_item has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function add_item()
                {
                    $menu_info = db()->get('SELECT * FROM ' . db('menus') . ' WHERE id=' . (int) ($_GET['id']));
                    if (empty($menu_info['id'])) {
                        return _e('No such menu!');
            Severity: Minor
            Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 1 hr to fix

              Function edit_item has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function edit_item()
                  {
                      $item_info = db()->query_fetch('SELECT * FROM ' . db('menu_items') . ' WHERE id=' . (int) ($_GET['id']));
                      if (empty($item_info['id'])) {
                          return _e('No such menu item!');
              Severity: Minor
              Found in plugins/sys/admin_modules/yf_menus_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 show_items has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function show_items()
                  {
                      $menu_info = db()->query_fetch('SELECT * FROM ' . db('menus') . ' WHERE id=' . (int) ($_GET['id']) . ' OR name="' . db()->es($_GET['id']) . '"');
                      if (empty($menu_info)) {
                          return _e('No such menu!');
              Severity: Minor
              Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 1 hr to fix

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

                    public function add_item()
                    {
                        $menu_info = db()->get('SELECT * FROM ' . db('menus') . ' WHERE id=' . (int) ($_GET['id']));
                        if (empty($menu_info['id'])) {
                            return _e('No such menu!');
                Severity: Minor
                Found in plugins/sys/admin_modules/yf_menus_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 clone_menu has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function clone_menu()
                    {
                        $_GET['id'] = (int) ($_GET['id']);
                        if (empty($_GET['id'])) {
                            return _e('No id!');
                Severity: Minor
                Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 1 hr to fix

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

                      public function show_items()
                      {
                          $menu_info = db()->query_fetch('SELECT * FROM ' . db('menus') . ' WHERE id=' . (int) ($_GET['id']) . ' OR name="' . db()->es($_GET['id']) . '"');
                          if (empty($menu_info)) {
                              return _e('No such menu!');
                  Severity: Minor
                  Found in plugins/sys/admin_modules/yf_menus_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_parents_for_select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _get_parents_for_select($menu_id, $skip_id = null)
                      {
                          $data = [0 => '-- TOP --'];
                          foreach ((array) $this->_recursive_get_menu_items($menu_id/*, $skip_id*/) as $cur_item_id => $cur_item_info) {
                              if (empty($cur_item_id)) {
                  Severity: Minor
                  Found in plugins/sys/admin_modules/yf_menus_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 _auto_update_items_orders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _auto_update_items_orders($menu_id)
                      {
                          if ( ! $menu_id) {
                              return false;
                          }
                  Severity: Minor
                  Found in plugins/sys/admin_modules/yf_menus_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 clone_menu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function clone_menu()
                      {
                          $_GET['id'] = (int) ($_GET['id']);
                          if (empty($_GET['id'])) {
                              return _e('No id!');
                  Severity: Minor
                  Found in plugins/sys/admin_modules/yf_menus_editor.class.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

                  Avoid too many return statements within this method.
                  Open

                              return $items;
                  Severity: Major
                  Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return tpl()->parse($STPL_MENU_MAIN, $replace);
                    Severity: Major
                    Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 30 mins to fix

                      Function _count_levels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function _count_levels($start_id = 0, &$children, $level = 0)
                          {
                              $ids = [];
                              foreach ((array) $children[$start_id] as $id => $_tmp) {
                                  $ids[$id] = $level;
                      Severity: Minor
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                  foreach ((array) json_decode((string) $_POST['items'], $assoc = true) as $order_id => $info) {
                                      $item_id = (int) $info['item_id'];
                                      if ( ! $item_id || ! isset($items[$item_id])) {
                                          continue;
                                      }
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 4 hrs to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 269..289

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 172.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if (main()->is_post()) {
                                  $tmp = [];
                                  foreach (explode(',', $menu_info['custom_fields']) as $field_name) {
                                      if ($field_name && $_POST['custom'][$field_name]) {
                                          $tmp[$field_name] = $field_name . '=' . $_POST['custom'][$field_name];
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 4 hrs to fix
                      plugins/sys/admin_modules/yf_menus_editor.class.php on lines 597..612

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 169.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if (main()->is_post()) {
                                  $tmp = [];
                                  foreach (explode(',', $menu_info['custom_fields']) as $field_name) {
                                      if ($field_name && $_POST['custom'][$field_name]) {
                                          $tmp[$field_name] = $field_name . '=' . $_POST['custom'][$field_name];
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 4 hrs to fix
                      plugins/sys/admin_modules/yf_menus_editor.class.php on lines 651..666

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 169.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function _auto_update_items_orders($menu_id)
                          {
                              if ( ! $menu_id) {
                                  return false;
                              }
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 3 hrs to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 468..493

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 146.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 3 locations. Consider refactoring.
                      Open

                          public function _recursive_sort_items($items = [], $skip_item_id = 0, $parent_id = 0, $level = 0)
                          {
                              $children = [];
                              foreach ((array) $items as $id => $info) {
                                  $parent_id = $info['parent_id'];
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 2 other locations - About 3 hrs to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 518..534
                      plugins/content/admin_modules/yf_manage_faq.class.php on lines 345..361

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 145.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function _get_parents_for_select($menu_id, $skip_id = null)
                          {
                              $data = [0 => '-- TOP --'];
                              foreach ((array) $this->_recursive_get_menu_items($menu_id/*, $skip_id*/) as $cur_item_id => $cur_item_info) {
                                  if (empty($cur_item_id)) {
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 1 hr to fix
                      plugins/content/admin_modules/yf_manage_faq.class.php on lines 285..298

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 108.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function _multi_db_to_html($input = '')
                          {
                              if ( ! is_array($input)) {
                                  $input = explode(',', str_replace([' ', "\t", "\r", "\n", ',,'], '', $input));
                              }
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 1 hr to fix
                      plugins/sys/admin_modules/yf_blocks.class.php on lines 439..451

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 107.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if ( ! empty($menu_info)) {
                                  db()->UPDATE('menus', ['active' => (int) ! $menu_info['active']], 'id=' . (int) ($menu_info['id']));
                                  common()->admin_wall_add(['menu: ' . $menu_info['name'] . ' ' . ($menu_info['active'] ? 'inactivated' : 'activated'), $menu_info['id']]);
                                  module('menus_editor')->_purge_caches();
                              }
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 1 other location - About 1 hr to fix
                      plugins/sys/admin_modules/yf_blocks.class.php on lines 412..416

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 107.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 6 locations. Consider refactoring.
                      Open

                          public function _count_levels($start_id = 0, &$children, $level = 0)
                          {
                              $ids = [];
                              foreach ((array) $children[$start_id] as $id => $_tmp) {
                                  $ids[$id] = $level;
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 5 other locations - About 1 hr to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 540..552
                      plugins/categories/classes/yf_cats.class.php on lines 137..149
                      plugins/content/admin_modules/yf_manage_faq.class.php on lines 367..379
                      plugins/html/classes/yf_html.class.php on lines 104..116
                      plugins/sys/classes/yf_core_menu.class.php on lines 456..468

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 104.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                              if ( ! empty($item_info)) {
                                  db()->update('menu_items', ['active' => (int) ! $item_info['active']], 'id=' . (int) ($item_info['id']));
                                  common()->admin_wall_add(['menu item: ' . $item_info['name'] . ' ' . ($item_info['active'] ? 'inactivated' : 'activated'), $item_info['id']]);
                              }
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 2 other locations - About 1 hr to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 196..199
                      plugins/user/admin_modules/yf_user_groups.class.php on lines 104..109

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 102.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 3 locations. Consider refactoring.
                      Open

                                  if ($icon) {
                                      // Icon class from bootstrap icon class names
                                      if (preg_match('/^icon\-[a-z0-9_-]+$/i', $icon) || (strpos($icon, '.') === false)) {
                                          $icon_class = $icon;
                                      } else {
                      Severity: Major
                      Found in plugins/sys/admin_modules/yf_menus_editor.class.php and 2 other locations - About 45 mins to fix
                      plugins/categories/admin_modules/yf_category_editor.class.php on lines 431..441
                      plugins/sys/classes/yf_core_menu.class.php on lines 119..129

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 96.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status