plugins/table2/classes/yf_table2.class.php

Summary

Maintainability
F
3 wks
Test Coverage

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

<?php

/**
 * Table2 high-level generator, mostly using bootstrap html/css framework.
 *
Severity: Major
Found in plugins/table2/classes/yf_table2.class.php - About 4 days to fix

    Function _render_get_data has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _render_get_data(&$params)
        {
            $default_per_page = MAIN_TYPE_USER ? conf('user_per_page') : conf('admin_per_page');
            if ($params['rotate_table']) {
                $default_per_page = 10;
    Severity: Minor
    Found in plugins/table2/classes/yf_table2.class.php - About 1 day 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

    yf_table2 has 69 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_table2
    {
        /* Example:
            return table('SELECT * FROM '.db('admin'))
                ->text('login')
    Severity: Major
    Found in plugins/table2/classes/yf_table2.class.php - About 1 day to fix

      Function render has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render($params = [])
          {
              if (DEBUG_MODE) {
                  $ts = microtime(true);
              }
      Severity: Minor
      Found in plugins/table2/classes/yf_table2.class.php - About 7 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 text has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          public function text($name, $desc = '', $extra = [])
          {
              // Shortcut: use second param as $extra
              if (is_array($desc)) {
                  $extra = (array) $extra + $desc;
      Severity: Minor
      Found in plugins/table2/classes/yf_table2.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

      Function _render_as_html has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _render_as_html(&$params, &$a, &$to_hide)
          {
              $body = '';
              $header_links = [];
              if (MAIN_TYPE_ADMIN && ! $params['no_pages'] && ! $params['no_total'] && $a['total']) {
      Severity: Minor
      Found in plugins/table2/classes/yf_table2.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 _render_get_data has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _render_get_data(&$params)
          {
              $default_per_page = MAIN_TYPE_USER ? conf('user_per_page') : conf('admin_per_page');
              if ($params['rotate_table']) {
                  $default_per_page = 10;
      Severity: Major
      Found in plugins/table2/classes/yf_table2.class.php - About 4 hrs to fix

        Function _render_add_custom_fields has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _render_add_custom_fields(&$params, &$data, &$ids)
            {
                if ( ! $data || ! $ids || ! $params['custom_fields']) {
                    return false;
                }
        Severity: Minor
        Found in plugins/table2/classes/yf_table2.class.php - About 4 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 text has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function text($name, $desc = '', $extra = [])
            {
                // Shortcut: use second param as $extra
                if (is_array($desc)) {
                    $extra = (array) $extra + $desc;
        Severity: Major
        Found in plugins/table2/classes/yf_table2.class.php - About 4 hrs to fix

          Method render has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function render($params = [])
              {
                  if (DEBUG_MODE) {
                      $ts = microtime(true);
                  }
          Severity: Major
          Found in plugins/table2/classes/yf_table2.class.php - About 3 hrs to fix

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

                public function _render_table_contents_rotated($data = [], $params, $to_hide = [])
                {
                    $tbody_attrs = '';
                    if (isset($params['tbody'])) {
                        $tbody_attrs = is_array($params['tbody']) ? _attrs($params['tbody'], ['class', 'id']) : ' ' . $params['tbody'];
            Severity: Minor
            Found in plugins/table2/classes/yf_table2.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

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

                public function _render_thead(&$params, &$a, &$to_hide)
                {
                    $data = &$a['data'];
                    $thead_attrs = '';
                    if (isset($params['thead'])) {
            Severity: Minor
            Found in plugins/table2/classes/yf_table2.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

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

                public function _render_table_contents($data, $params = [], $to_hide = [])
                {
                    $tbody_attrs = '';
                    if (isset($params['tbody'])) {
                        $tbody_attrs = is_array($params['tbody']) ? _attrs($params['tbody'], ['class', 'id']) : ' ' . $params['tbody'];
            Severity: Minor
            Found in plugins/table2/classes/yf_table2.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

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

                public function _render_auto(&$params, &$data)
                {
                    if ($params['auto'] && $data) {
                        $field_names = array_keys((array) current((array) $data));
                        $skip_fields = [];
            Severity: Minor
            Found in plugins/table2/classes/yf_table2.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 _render_as_html has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _render_as_html(&$params, &$a, &$to_hide)
                {
                    $body = '';
                    $header_links = [];
                    if (MAIN_TYPE_ADMIN && ! $params['no_pages'] && ! $params['no_total'] && $a['total']) {
            Severity: Major
            Found in plugins/table2/classes/yf_table2.class.php - About 3 hrs to fix

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

                  public function user($name = '', $extra = [])
                  {
                      if (is_array($name)) {
                          $extra = (array) $extra + $name;
                          $name = '';
              Severity: Major
              Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

                Method btn has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function btn($name, $link, $extra = [])
                    {
                        if (is_array($link)) {
                            $extra = $link;
                            $link = '';
                Severity: Major
                Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

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

                      public function btn($name, $link, $extra = [])
                      {
                          if (is_array($link)) {
                              $extra = $link;
                              $link = '';
                  Severity: Minor
                  Found in plugins/table2/classes/yf_table2.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 btn_active has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function btn_active($name = '', $link = '', $extra = [])
                      {
                          if (is_array($name)) {
                              $extra = $name;
                              $name = '';
                  Severity: Major
                  Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

                    Function btn_active has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function btn_active($name = '', $link = '', $extra = [])
                        {
                            if (is_array($name)) {
                                $extra = $name;
                                $name = '';
                    Severity: Minor
                    Found in plugins/table2/classes/yf_table2.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

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

                        public function _render_table_td($info, $row, $params, $row_id)
                        {
                            $name = $info['name'];
                            if ( ! array_key_exists($name, $row)) {
                                return false;
                    Severity: Minor
                    Found in plugins/table2/classes/yf_table2.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 _render_add_custom_fields has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _render_add_custom_fields(&$params, &$data, &$ids)
                        {
                            if ( ! $data || ! $ids || ! $params['custom_fields']) {
                                return false;
                            }
                    Severity: Major
                    Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

                      Method footer_link has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function footer_link($name, $link, $extra = [])
                          {
                              $item = [
                                  'type' => __FUNCTION__,
                                  'name' => $name,
                      Severity: Minor
                      Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                        Method _render_thead has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function _render_thead(&$params, &$a, &$to_hide)
                            {
                                $data = &$a['data'];
                                $thead_attrs = '';
                                if (isset($params['thead'])) {
                        Severity: Minor
                        Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

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

                              public function _process_link_params($link, $row = [], $extra = [])
                              {
                                  if ( ! strlen($link) || empty($row) || false === strpos($link, '%')) {
                                      return $link;
                                  }
                          Severity: Minor
                          Found in plugins/table2/classes/yf_table2.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 footer_link has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function footer_link($name, $link, $extra = [])
                              {
                                  $item = [
                                      'type' => __FUNCTION__,
                                      'name' => $name,
                          Severity: Minor
                          Found in plugins/table2/classes/yf_table2.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 _render_table_td has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function _render_table_td($info, $row, $params, $row_id)
                              {
                                  $name = $info['name'];
                                  if ( ! array_key_exists($name, $row)) {
                                      return false;
                          Severity: Minor
                          Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                            Method _render_table_contents_rotated has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function _render_table_contents_rotated($data = [], $params, $to_hide = [])
                                {
                                    $tbody_attrs = '';
                                    if (isset($params['tbody'])) {
                                        $tbody_attrs = is_array($params['tbody']) ? _attrs($params['tbody'], ['class', 'id']) : ' ' . $params['tbody'];
                            Severity: Minor
                            Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                              Method footer_submit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function footer_submit($name = '', $extra = [])
                                  {
                                      if (is_array($name)) {
                                          $extra = $name;
                                          $name = $extra['name'];
                              Severity: Minor
                              Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                                Method _render_table_contents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function _render_table_contents($data, $params = [], $to_hide = [])
                                    {
                                        $tbody_attrs = '';
                                        if (isset($params['tbody'])) {
                                            $tbody_attrs = is_array($params['tbody']) ? _attrs($params['tbody'], ['class', 'id']) : ' ' . $params['tbody'];
                                Severity: Minor
                                Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                                  Method stars has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function stars($name, $desc = '', $extra = [])
                                      {
                                          if (is_array($desc)) {
                                              $extra = (array) $extra + $desc;
                                              $desc = '';
                                  Severity: Minor
                                  Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

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

                                        public function _hidden_data_container($row, $params, $instance_params)
                                        {
                                            $extra = $params['extra'];
                                            $hidden_data = $extra['hidden_data'];
                                            if (empty($hidden_data)) {
                                    Severity: Minor
                                    Found in plugins/table2/classes/yf_table2.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 _render_debug_info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function _render_debug_info(&$params, $ts = 0, $trace = '')
                                        {
                                            if ( ! DEBUG_MODE) {
                                                return false;
                                            }
                                    Severity: Minor
                                    Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                                      Method _render_auto has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function _render_auto(&$params, &$data)
                                          {
                                              if ($params['auto'] && $data) {
                                                  $field_names = array_keys((array) current((array) $data));
                                                  $skip_fields = [];
                                      Severity: Minor
                                      Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

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

                                            public function _apply_badges($text, $extra = [], $field = null)
                                            {
                                                if ($extra['badge']) {
                                                    $badge = is_array($extra['badge']) && isset($extra['badge'][$field]) ? $extra['badge'][$field] : $extra['badge'];
                                                    if ($badge) {
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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 _render_totals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function _render_totals(&$params, &$a, &$to_hide)
                                            {
                                                $data = &$a['data'];
                                                $total_fields = $params['totals'];
                                        
                                        
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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 btn_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function btn_delete($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function _data_group_by($data, $group_by)
                                            {
                                                $index = [];
                                                $inverse = [];
                                                foreach ($data as $id => $row) {
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function _apply_transform($text, $trans)
                                            {
                                                if (is_string($trans) && strpos($trans, '|') !== false) {
                                                    $trans = explode('|', $trans);
                                                }
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function _show_tip($value = '', $name = '', $row = [])
                                            {
                                                $tip = '';
                                                if (is_string($value)) {
                                                    $tip = $value;
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function btn_edit($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function func($name, $func = null, $extra = [])
                                            {
                                                if ( ! is_string($name) && is_callable($name)) {
                                                    if (is_array($func)) {
                                                        $extra = (array) $extra + $func;
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function btn_view($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function btn_clone($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function footer_submit($name = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = $extra['name'];
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function admin($name = '', $link = '', $data = '', $extra = [])
                                            {
                                                if (is_array($link)) {
                                                    $extra = (array) $extra + $link;
                                                    $link = '';
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function _is_link_allowed($link = '')
                                            {
                                                $link = trim($link);
                                                if ( ! strlen($link)) {
                                                    return true;
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function _render_debug_info(&$params, $ts = 0, $trace = '')
                                            {
                                                if ( ! DEBUG_MODE) {
                                                    return false;
                                                }
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function footer_add($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = $extra['name'];
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.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

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

                                            public function btn_view($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 3 other locations - About 6 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1732..1757
                                        plugins/table2/classes/yf_table2.class.php on lines 1764..1789
                                        plugins/table2/classes/yf_table2.class.php on lines 1796..1821

                                        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 215.

                                        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 4 locations. Consider refactoring.
                                        Open

                                            public function btn_edit($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 3 other locations - About 6 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1764..1789
                                        plugins/table2/classes/yf_table2.class.php on lines 1796..1821
                                        plugins/table2/classes/yf_table2.class.php on lines 1828..1853

                                        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 215.

                                        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 4 locations. Consider refactoring.
                                        Open

                                            public function btn_delete($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 3 other locations - About 6 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1732..1757
                                        plugins/table2/classes/yf_table2.class.php on lines 1796..1821
                                        plugins/table2/classes/yf_table2.class.php on lines 1828..1853

                                        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 215.

                                        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 4 locations. Consider refactoring.
                                        Open

                                            public function btn_clone($name = '', $link = '', $extra = [])
                                            {
                                                if (is_array($name)) {
                                                    $extra = $name;
                                                    $name = '';
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 3 other locations - About 6 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1732..1757
                                        plugins/table2/classes/yf_table2.class.php on lines 1764..1789
                                        plugins/table2/classes/yf_table2.class.php on lines 1828..1853

                                        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 215.

                                        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 radio_box($name, $extra = [])
                                            {
                                                $this->form();
                                                return $this->func($name, function ($field, $params, $row) {
                                                    $extra = $params['extra'];
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 5 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 2241..2258

                                        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 187.

                                        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 select_box($name, $extra = [])
                                            {
                                                $this->form();
                                                return $this->func($name, function ($field, $params, $row) {
                                                    $extra = $params['extra'];
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 5 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 2217..2235

                                        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 187.

                                        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 _apply_transform($text, $trans)
                                            {
                                                if (is_string($trans) && strpos($trans, '|') !== false) {
                                                    $trans = explode('|', $trans);
                                                }
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 3 hrs to fix
                                        plugins/tpl/classes/yf_tpl.class.php on lines 998..1014

                                        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 allow_deny($name, $extra = [])
                                            {
                                                if ( ! isset($this->_pair_allow_deny)) {
                                                    $this->_pair_allow_deny = str_replace('class="', 'disabled class="', main()->get_data('pair_allow_deny'));
                                                }
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 2 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1565..1576

                                        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 129.

                                        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 yes_no($name = '', $extra = [])
                                            {
                                                if ( ! isset($this->_pair_yes_no)) {
                                                    $this->_pair_yes_no = str_replace('class="', 'disabled class="', main()->get_data('pair_yes_no'));
                                                }
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 2 hrs to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1548..1559

                                        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 129.

                                        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 (is_numeric($id)) {
                                                            $id && $user_ids[$id] = $id;
                                                        } elseif (is_array($id)) {
                                                            foreach ((array) $id as $_id) {
                                                                $_id && $user_ids[$_id] = $_id;
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 1 hr to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1352..1363

                                        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 103.

                                        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 (is_numeric($id)) {
                                                        $user_ids[$id] = $id;
                                                    } elseif (is_array($id)) {
                                                        foreach ((array) $id as $_id) {
                                                            $_id && $user_ids[$_id] = $_id;
                                        Severity: Major
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 1 hr to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 1326..1337

                                        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 103.

                                        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

                                                        foreach (range(1, $stars) as $num) {
                                                            $is_ok = $input >= ($num * $max / $stars) ? 1 : 0;
                                                            $body[] = '<i class="' . $class . ' ' . ($is_ok ? $class_ok : $class_ko) . '" style="color:' . ($is_ok ? $color_ok : $color_ko) . ';" title="' . $input . '"></i>';
                                                        }
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 40 mins to fix
                                        plugins/form2/classes/form2/yf_form2_stars.class.php on lines 33..36

                                        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 94.

                                        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

                                                } elseif ($extra['label']) {
                                                    $label = is_array($extra['label']) && isset($extra['label'][$field]) ? $extra['label'][$field] : $extra['label'];
                                                    if ($label) {
                                                        $text = '<span class="' . str_replace('%name', $label, $this->CLASS_TPL_LABEL) . '">' . $text . '</span>';
                                                    }
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 40 mins to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 973..988

                                        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 94.

                                        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 ($extra['badge']) {
                                                    $badge = is_array($extra['badge']) && isset($extra['badge'][$field]) ? $extra['badge'][$field] : $extra['badge'];
                                                    if ($badge) {
                                                        $text = '<span class="' . str_replace('%name', $badge, $this->CLASS_TPL_BADGE) . '">' . $text . '</span>';
                                                    }
                                        Severity: Minor
                                        Found in plugins/table2/classes/yf_table2.class.php and 1 other location - About 40 mins to fix
                                        plugins/table2/classes/yf_table2.class.php on lines 978..983

                                        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 94.

                                        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