plugins/form2/classes/yf_form2.class.php

Summary

Maintainability
F
1 mo
Test Coverage

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

<?php

/**
 * Form2 high-level generator and handler, mostly using bootstrap html/css framework.
 *
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php - About 1 wk to fix

    yf_form2 has 165 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_form2
    {
        public $CLASS_FORM_MAIN = 'form-horizontal';// col-md-6'
        public $CLASS_FORM_CONTROL = 'form-control';
        public $CLASS_CKEDITOR = 'ckeditor';
    Severity: Major
    Found in plugins/form2/classes/yf_form2.class.php - About 3 days to fix

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

          public function render($extra = [], $replace = [])
          {
              if (isset($this->_rendered)) {
                  return $this->_rendered;
              }
      Severity: Minor
      Found in plugins/form2/classes/yf_form2.class.php - About 2 days 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 has 267 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render($extra = [], $replace = [])
          {
              if (isset($this->_rendered)) {
                  return $this->_rendered;
              }
      Severity: Major
      Found in plugins/form2/classes/yf_form2.class.php - About 1 day to fix

        Function _validate_rules_process has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _validate_rules_process($validate_rules = [], &$data)
            {
                $validate_ok = true;
                foreach ((array) $validate_rules as $name => $rules) {
                    $is_required = false;
        Severity: Minor
        Found in plugins/form2/classes/yf_form2.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

        Function _db_change_if_ok has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _db_change_if_ok($table, $fields, $type, $extra = [])
            {
                $func = function ($table, $fields, $type, $extra, $form) {
                    if ( ! $table || ! $type || empty($_POST)) {
                        return $form;
        Severity: Minor
        Found in plugins/form2/classes/yf_form2.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 phone_box has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function phone_box($name = '', $extra = [], $replace = [])
            {
                if (is_array($name)) {
                    $extra = (array) $extra + $name;
                } else {
        Severity: Major
        Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

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

              public function _db_change_if_ok($table, $fields, $type, $extra = [])
              {
                  $func = function ($table, $fields, $type, $extra, $form) {
                      if ( ! $table || ! $type || empty($_POST)) {
                          return $form;
          Severity: Major
          Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

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

                public function _validate_prepare($validate_rules = [], $extra = [])
                {
                    $form_global_validate = isset($this->_params['validate']) ? $this->_params['validate'] : (isset($this->_replace['validate']) ? $this->_replace['validate'] : []);
                    foreach ((array) $form_global_validate as $name => $rules) {
                        $this->_validate_rules[$name] = $rules;
            Severity: Minor
            Found in plugins/form2/classes/yf_form2.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 validate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate($validate_rules = [], $post = [], $extra = [])
                {
                    $this->_validate_prepare($validate_rules, $extra);
            
                    $func = function ($validate_rules, $post, $extra, $form) {
            Severity: Minor
            Found in plugins/form2/classes/yf_form2.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 validate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function validate($validate_rules = [], $post = [], $extra = [])
                {
                    $this->_validate_prepare($validate_rules, $extra);
            
                    $func = function ($validate_rules, $post, $extra, $form) {
            Severity: Major
            Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

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

                  public function info($name, $desc = '', $extra = [], $replace = [])
                  {
                      if (is_array($desc)) {
                          $extra = (array) $extra + $desc;
                          $desc = '';
              Severity: Minor
              Found in plugins/form2/classes/yf_form2.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 info has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method form_begin has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method _validate_rules_process has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _validate_rules_process($validate_rules = [], &$data)
                      {
                          $validate_ok = true;
                          foreach ((array) $validate_rules as $name => $rules) {
                              $is_required = false;
                  Severity: Major
                  Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

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

                        public function submit($name = '', $value = '', $extra = [], $replace = [])
                        {
                            if (is_array($name)) {
                                $extra = (array) $extra + $name;
                                $name = '';
                    Severity: Minor
                    Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

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

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

                            public function _prepare_css_class($default_class = '', $value = '', &$extra)
                            {
                                $css_class = $default_class;
                                if ($extra['badge']) {
                                    $badge = is_array($extra['badge']) && isset($extra['badge'][$value]) ? $extra['badge'][$value] : $extra['badge'];
                        Severity: Minor
                        Found in plugins/form2/classes/yf_form2.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 form_begin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function form_begin($name = '', $method = '', $extra = [], $replace = [])
                            {
                                if (is_array($name)) {
                                    $extra = (array) $extra + $name;
                                    $name = '';
                        Severity: Minor
                        Found in plugins/form2/classes/yf_form2.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 tpl_row has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function tpl_row($type = 'input', $replace = [], $name = '', $desc = '', $extra = [])
                            {
                                $name = trim($name);
                                if ($name && $name[0] == '%') {
                                    $_name = substr($name, 1);
                        Severity: Minor
                        Found in plugins/form2/classes/yf_form2.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 _validate_prepare has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function _validate_prepare($validate_rules = [], $extra = [])
                            {
                                $form_global_validate = isset($this->_params['validate']) ? $this->_params['validate'] : (isset($this->_replace['validate']) ? $this->_replace['validate'] : []);
                                foreach ((array) $form_global_validate as $name => $rules) {
                                    $this->_validate_rules[$name] = $rules;
                        Severity: Minor
                        Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

                              public function _find_custom_validate_error($name, $func)
                              {
                                  if ( ! strlen($name)) {
                                      return '';
                                  }
                          Severity: Minor
                          Found in plugins/form2/classes/yf_form2.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 _html_control has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function _html_control($name, $values, $extra = [], $replace = [], $func_html_control = '')
                              {
                                  if ( ! is_array($extra)) {
                                      $extra = [];
                                  }
                          Severity: Minor
                          Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

                            Method input has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method _get_extra_override has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function _get_extra_override($form_id = '')
                                  {
                                      if ( ! strlen($form_id)) {
                                          return [];
                                      }
                              Severity: Minor
                              Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

                                Method custom_fields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function custom_fields($name, $custom_fields, $extra = [], $replace = [])
                                    {
                                        if ( ! is_array($extra)) {
                                            $extra = [];
                                        }
                                Severity: Minor
                                Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

                                      public function _get_extra_override($form_id = '')
                                      {
                                          if ( ! strlen($form_id)) {
                                              return [];
                                          }
                                  Severity: Minor
                                  Found in plugins/form2/classes/yf_form2.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 _find_field_desc has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function _find_field_desc($name)
                                      {
                                          if ( ! strlen($name)) {
                                              return '';
                                          }
                                  Severity: Minor
                                  Found in plugins/form2/classes/yf_form2.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 textarea has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

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

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

                                        public function tpl_row($type = 'input', $replace = [], $name = '', $desc = '', $extra = [])
                                        {
                                            $name = trim($name);
                                            if ($name && $name[0] == '%') {
                                                $_name = substr($name, 1);
                                    Severity: Minor
                                    Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

                                          public function _prepare_selected($name, &$extra, &$r)
                                          {
                                              $is_array = strpos($name, '[');
                                              if ($is_array !== false) {
                                                  $value = &$r;
                                      Severity: Minor
                                      Found in plugins/form2/classes/yf_form2.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 active_box has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function active_box($name = '', $desc = '', $extra = [], $replace = [])
                                          {
                                              if (is_array($name)) {
                                                  $extra += $name;
                                                  $desc = '';
                                      Severity: Minor
                                      Found in plugins/form2/classes/yf_form2.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 _prepare_css_class has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function _prepare_css_class($default_class = '', $value = '', &$extra)
                                          {
                                              $css_class = $default_class;
                                              if ($extra['badge']) {
                                                  $badge = is_array($extra['badge']) && isset($extra['badge'][$value]) ? $extra['badge'][$value] : $extra['badge'];
                                      Severity: Minor
                                      Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

                                            public function container($text, $desc = '', $extra = [], $replace = [])
                                            {
                                                if (is_array($desc)) {
                                                    $extra = (array) $extra + $desc;
                                                    $desc = '';
                                        Severity: Minor
                                        Found in plugins/form2/classes/yf_form2.class.php - About 1 hr to fix

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

                                              public function submit($name = '', $value = '', $extra = [], $replace = [])
                                              {
                                                  if (is_array($name)) {
                                                      $extra = (array) $extra + $name;
                                                      $name = '';
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.class.php - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

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

                                              public function chained_wrapper($replace = [], $params = [])
                                              {
                                                  if ($replace && is_string($replace)) {
                                                      $sql = $replace;
                                                      $this->_sql = $sql;
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.class.php - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

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

                                              public function _html_control($name, $values, $extra = [], $replace = [], $func_html_control = '')
                                              {
                                                  if ( ! is_array($extra)) {
                                                      $extra = [];
                                                  }
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.class.php - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

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

                                              public function phone_box($name = '', $extra = [], $replace = [])
                                              {
                                                  if (is_array($name)) {
                                                      $extra = (array) $extra + $name;
                                                  } else {
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.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 array_to_form has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public function array_to_form($a = [], $params = [], $replace = [])
                                              {
                                                  $this->_params = $params + (array) $this->_params;
                                                  $this->_replace = $replace + (array) $this->_replace;
                                                  // Example of row: ['text', 'login', ['class' => 'input-medium']]
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.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 _prepare_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public function _prepare_value(&$extra, &$replace, &$params)
                                              {
                                                  $name = $extra['name'];
                                                  $is_html_array = (false !== strpos($name, '['));
                                                  if ($is_html_array) {
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.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 func has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public function func($name, $func, $extra = [], $replace = [])
                                              {
                                                  if (is_array($func)) {
                                                      $extra = (array) $extra + $func;
                                                      $func = '';
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.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

                                          Method _html_control has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              public function _html_control($name, $values, $extra = [], $replace = [], $func_html_control = '')
                                          Severity: Minor
                                          Found in plugins/form2/classes/yf_form2.class.php - About 35 mins to fix

                                            Method tpl_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                public function tpl_row($type = 'input', $replace = [], $name = '', $desc = '', $extra = [])
                                            Severity: Minor
                                            Found in plugins/form2/classes/yf_form2.class.php - About 35 mins to fix

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

                                                  public function _row_html($content, $extra = [], $replace = [])
                                                  {
                                                      if ( ! strlen($content) && ($extra['hide_empty'] || $this->_params['hide_empty'])) {
                                                          return '';
                                                      }
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function input($name, $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if (is_array($desc)) {
                                                          $extra = (array) $extra + $desc;
                                                          $desc = '';
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 save_and_clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function save_and_clear($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! $name) {
                                                          $name = 'clear_link';
                                                          $r = $replace ? $replace : $this->_replace;
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 save_and_back has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function save_and_back($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! $name) {
                                                          $name = 'back_link';
                                                          $r = $replace ? $replace : $this->_replace;
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 _remove_items_by_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function _remove_items_by_name($name = '')
                                                  {
                                                      if (is_array($name)) {
                                                          $func = __FUNCTION__;
                                                          foreach ((array) $name as $_name) {
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 _prepare_inline_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function _prepare_inline_error(&$extra, $name = '')
                                                  {
                                                      $name = $name ?: $extra['name'];
                                                      $is_html_array = (false !== strpos($name, '['));
                                                      if ($is_html_array) {
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 __clone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function __clone()
                                                  {
                                                      $keep_prefix = 'CLASS_';
                                                      $keep_len = strlen($keep_prefix);
                                                      $keep_prefix2 = 'CONF_';
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 fieldset_start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function fieldset_start($name = '', $extra = [])
                                                  {
                                                      if (is_array($name)) {
                                                          $extra = (array) $extra + $name;
                                                          $name = '';
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 custom_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function custom_fields($name, $custom_fields, $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.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 2 locations. Consider refactoring.
                                              Open

                                                  public function save_and_back($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! $name) {
                                                          $name = 'back_link';
                                                          $r = $replace ? $replace : $this->_replace;
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 6 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 2056..2078

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

                                              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 save_and_clear($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! $name) {
                                                          $name = 'clear_link';
                                                          $r = $replace ? $replace : $this->_replace;
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 6 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 2026..2048

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

                                              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_box($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if (is_array($desc)) {
                                                          $extra = (array) $extra + $desc;
                                                          $desc = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 6 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1878..1898

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

                                              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_box($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if (is_array($desc)) {
                                                          $extra = (array) $extra + $desc;
                                                          $desc = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 6 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1906..1926

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

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

                                                  public function datetime($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function datetime_local($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function date($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function range($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function color($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function month($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

                                                  public function tel($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1706..1720

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

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

                                                  public function search($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1568..1582
                                              plugins/form2/classes/yf_form2.class.php on lines 1591..1605
                                              plugins/form2/classes/yf_form2.class.php on lines 1614..1628
                                              plugins/form2/classes/yf_form2.class.php on lines 1637..1651
                                              plugins/form2/classes/yf_form2.class.php on lines 1660..1674
                                              plugins/form2/classes/yf_form2.class.php on lines 1683..1697
                                              plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

                                              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

                                                  public function time($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 2 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1752..1766
                                              plugins/form2/classes/yf_form2.class.php on lines 1798..1812

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

                                              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

                                                  public function week($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 2 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1752..1766
                                              plugins/form2/classes/yf_form2.class.php on lines 1775..1789

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

                                              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

                                                  public function phone($name = '', $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if ( ! is_array($extra)) {
                                                          $extra = [];
                                                      }
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 2 other locations - About 2 hrs to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1775..1789
                                              plugins/form2/classes/yf_form2.class.php on lines 1798..1812

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

                                              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 time_box($name = '', $values = [], $extra = [], $replace = [])
                                                  {
                                                      if (is_array($name)) {
                                                          $extra = (array) $extra + $name;
                                                          $name = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 2686..2699

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

                                              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 date_box($name = '', $values = [], $extra = [], $replace = [])
                                                  {
                                                      if (is_array($name)) {
                                                          $extra = (array) $extra + $name;
                                                          $name = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 2707..2720

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

                                              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 price($name, $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if (is_array($desc)) {
                                                          $extra = (array) $extra + $desc;
                                                          $desc = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1480..1491

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

                                              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 decimal($name, $desc = '', $extra = [], $replace = [])
                                                  {
                                                      if (is_array($desc)) {
                                                          $extra = (array) $extra + $desc;
                                                          $desc = '';
                                              Severity: Major
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 1520..1531

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

                                              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 ($validate_ok) {
                                                              $form->_validate_ok = true;
                                                              $on_validate_ok = isset($extra['on_validate_ok']) ? $extra['on_validate_ok'] : $form->_on['on_validate_ok'];
                                                              if (is_callable($on_validate_ok)) {
                                                                  $on_validate_ok($data, $extra, $form->_validate_rules, $this);
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 55 mins to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 3324..3331

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

                                              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

                                                          } else {
                                                              $form->_validate_ok = false;
                                                              $on_validate_error = isset($extra['on_validate_error']) ? $extra['on_validate_error'] : $form->_on['on_validate_error'];
                                                              if (is_callable($on_validate_error)) {
                                                                  $on_validate_error($data, $extra, $form->_validate_rules, $this);
                                              Severity: Minor
                                              Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 55 mins to fix
                                              plugins/form2/classes/yf_form2.class.php on lines 3317..3331

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

                                              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