Showing 4,217 of 4,217 total issues

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

<?php

class yf_manage_notifications
{
    public $RECEIVER_TYPES = [
Severity: Minor
Found in plugins/notifications/admin_modules/yf_manage_notifications.class.php - About 4 hrs to fix

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

        public function exists($in, $params = [])
        {
            if ( ! $in) {
                return false;
            }
    Severity: Major
    Found in classes/yf_validate.class.php and 1 other location - About 4 hrs to fix
    classes/yf_validate.class.php on lines 603..623

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

    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 is_unique($in, $params = [])
        {
            if ( ! $in) {
                return true;
            }
    Severity: Major
    Found in classes/yf_validate.class.php and 1 other location - About 4 hrs to fix
    classes/yf_validate.class.php on lines 661..681

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

    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

    Method view has 115 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function view()
        {
            // check operation
            $operation = $this->_operation();
            // import options
    Severity: Major
    Found in plugins/payment/admin_modules/yf_manage_transfer.class.php - About 4 hrs to fix

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

          public function multi_check_box($name, $values = [], $selected = [], $horizontal = true, $type = 2, $add_str = '', $translate = 0, $name_as_array = false)
          {
              if (is_array($name)) {
                  $extra = (array) $extra + $name;
                  $name = $extra['name'];
      Severity: Minor
      Found in plugins/html/classes/yf_html.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

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

          public function _do_login()
          {
              $AUTH_LOGIN = trim($_POST[$this->LOGIN_FIELD]);
              $AUTH_PSWD = trim($_POST[$this->PSWD_FIELD]);
      
      
      Severity: Minor
      Found in plugins/auth/classes/auth/yf_auth_admin.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

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

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

      Cognitive Complexity

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

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

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

      Further reading

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

          public function _currency_convert($number = 0, $c_from = '', $c_to = '')
          {
              if ( ! $number || ! $c_from || ! $c_to) {
                  return $number;
              }
      Severity: Minor
      Found in plugins/common/classes/common/yf_other_common.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

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

          public function _store_item($data = [])
          {
              if (is_string($data) && strlen($data)) {
                  $data = ['url' => $data];
              }
      Severity: Minor
      Found in plugins/site_map/modules/yf_site_map.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 show has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function show()
          {
              $object = &$this->object;
              $action = &$this->action;
              $filter_name = &$this->filter_name;
      Severity: Major
      Found in plugins/payment/admin_modules/yf_manage_deposit.class.php - About 4 hrs to fix

        Method _show_for_object_tree has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _show_for_object_tree($params = [])
            {
                $OBJECT_NAME = ! empty($params['object_name']) ? $params['object_name'] : $_GET['object'];
                $OBJECT_ID = ! empty($params['object_id']) ? (int) ($params['object_id']) : (int) ($_GET['id']);
                $STPL_NAME_MAIN = ! empty($params['stpl_main']) ? $params['stpl_main'] : 'comments/main_tree';
        Severity: Major
        Found in plugins/comments/modules/yf_comments.class.php - About 4 hrs to fix

          Method conf has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function conf($name = null, $new_value = null, $_arr_name = '')
              {
                  $_arr_sub = null;
                  if ( ! $_arr_name) {
                      $_arr_name = 'CONF';
          Severity: Major
          Found in functions/yf_conf.php - About 4 hrs to fix

            yf_db_migrator has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class yf_db_migrator
            {
                /**
                 * Catch missing method call.
                 * @param mixed $name
            Severity: Minor
            Found in plugins/db/classes/db/yf_db_migrator.class.php - About 4 hrs to fix

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

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

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 172.

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

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

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

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

                Refactorings

                Further Reading

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

                            foreach ((array) json_decode((string) $_POST['items'], $assoc = true) as $order_id => $info) {
                                $item_id = (int) $info['item_id'];
                                if ( ! $item_id || ! isset($items[$item_id])) {
                                    continue;
                                }
                plugins/sys/admin_modules/yf_menus_editor.class.php on lines 291..311

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 172.

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

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

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

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

                Refactorings

                Further Reading

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

                <?php
                
                /**
                 * Unicode methods.
                 *
                Severity: Minor
                Found in classes/yf_utf8.class.php - About 4 hrs to fix

                  Method _recreate has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _recreate($options = null)
                      {
                          // import operation
                          is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                          // var
                  Severity: Major
                  Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 4 hrs to fix

                    Method compact_info has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function compact_info()
                        {
                            main()->NO_GRAPHICS = true;
                            conf('no_ajax_here', true);
                            // Check user id
                    Severity: Major
                    Found in plugins/user/modules/yf_user_profile.class.php - About 4 hrs to fix

                      Function multi_select has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function multi_select($name, $values = [], $selected = '', $show_text = false, $type = 2, $add_str = '', $translate = 0, $level = 0, $disabled = false)
                          {
                              // Passing params as array
                              if (is_array($name)) {
                                  $extra = (array) $extra + $name;
                      Severity: Minor
                      Found in plugins/html/classes/yf_html.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

                      Severity
                      Category
                      Status
                      Source
                      Language