Showing 4,217 of 4,217 total issues

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

    public function _show($return_array = false)
    {
        if ($return_array) {
            $this->_nav_item_as_array = true;
        }
Severity: Minor
Found in plugins/site_nav_bar/modules/yf_site_nav_bar.class.php - About 1 hr to fix

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

        public function edit()
        {
            $a = $this->_get_info();
            if ( ! $a) {
                return _404();
    Severity: Minor
    Found in plugins/email/admin_modules/yf_manage_emails.class.php - About 1 hr to fix

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

          public function _parse_column_type($str, &$error = false)
          {
              // TODO: use db ddl parser if available for the given db family (mysql currently supported)
              $str = trim($str);
              $type = $length = $decimals = $values = null;
      Severity: Minor
      Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 1 hr to fix

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

            public function _get_comments($NUM_NEWEST_COMMENTS, $user_id = '')
            {
                foreach ((array) module('comments')->COMMENT_LINKS as $key => $value) {
                    $where .= 'object_name="' . $key . '"';
                    if ($value !== end(module('comments')->COMMENT_LINKS)) {
        Severity: Minor
        Found in plugins/comments/modules/comments/yf_comments_integration.class.php - About 1 hr to fix

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

              public function send($phone, $text, $params = [])
              {
                  if ( ! $this->_is_enabled()) {
                      return false;
                  }
          Severity: Minor
          Found in plugins/sms/classes/yf_service_turbosms.class.php - About 1 hr to fix

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

                public function _lst($id, $with_root = false)
                {
                    $dir = $this->_path($id);
                    $res = [];
                    foreach (glob(rtrim($dir, '/') . '/*') as $f) {
            Severity: Minor
            Found in plugins/ckeditor/admin_modules/yf_ck_file_browser.class.php - About 1 hr to fix

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

                  public function write_file($server_info = [], $local_file = '', $remote_file = '')
                  {
                      $local_file = trim($local_file);
                      $remote_file = _class('ssh')->_prepare_path($remote_file);
                      if ( ! _class('ssh')->_INIT_OK || ! $server_info || ! strlen($local_file) || ! strlen($remote_file)) {
              Severity: Minor
              Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php - About 1 hr to fix

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

                    public function supplier_add()
                    {
                        if (main()->is_post()) {
                            if ( ! $_POST['name']) {
                                _re('Product name must be filled');

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

                      protected function _upload_item__get($id)
                      {
                          $result = [
                              'status' => false,
                          ];

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

                        public function test_table_info()
                        {
                            if ($this->_need_skip_test(__FUNCTION__)) {
                                return;
                            }
                    Severity: Minor
                    Found in .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php - About 1 hr to fix

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

                          public function test_update_foreign_key()
                          {
                              if ($this->_need_skip_test(__FUNCTION__)) {
                                  return;
                              }
                      Severity: Minor
                      Found in .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php - About 1 hr to fix

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

                                if ($is_local) {
                                    $move_result = false;
                                    if ( ! file_exists($ARCHIVE_PATH) && file_exists($ARCHIVE['tmp_name'])) {
                                        file_put_contents($ARCHIVE_PATH, file_get_contents($ARCHIVE['tmp_name']));
                                        unlink($ARCHIVE['tmp_name']);
                        Severity: Major
                        Found in plugins/common/classes/common/yf_upload_archive.class.php and 1 other location - About 1 hr to fix
                        plugins/common/classes/common/yf_upload_image.class.php on lines 63..72

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

                        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 ($is_local) {
                                    $move_result = false;
                                    if ( ! file_exists($photo_path) && file_exists($PHOTO['tmp_name'])) {
                                        file_put_contents($photo_path, file_get_contents($PHOTO['tmp_name']));
                                        unlink($PHOTO['tmp_name']);
                        Severity: Major
                        Found in plugins/common/classes/common/yf_upload_image.class.php and 1 other location - About 1 hr to fix
                        plugins/common/classes/common/yf_upload_archive.class.php on lines 46..55

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

                        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

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

                            public function filters_process_input($in, $filters = [], $params = [])
                            {
                                if (is_array($in)) {
                                    $out = [];
                                    $func = __FUNCTION__;
                        Severity: Minor
                        Found in plugins/assets/classes/yf_assets.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 _user_message has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function _user_message($options = null)
                            {
                                $url = &$this->url;
                                // import operation
                                is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                        Severity: Minor
                        Found in plugins/payment/admin_modules/yf_manage_transfer.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 date_box2 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function date_box2($name, $selected = '', $years = '', $add_str = '', $show_what = 'ymd', $show_text = 1, $translate = 1)
                            {
                                if (is_array($selected)) {
                                    $extra = (array) $extra + $name;
                                    $name = $extra['name'];
                        Severity: Minor
                        Found in plugins/html/classes/html/yf_html_datetime.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 _on_validate_ok has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function _on_validate_ok($params = [], $form)
                            {
                                $p = $params ?: $_POST;
                                $lang = $p['lang'];
                                $to_export = [];

                        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 date_box has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function date_box($selected = '', $years = '', $name_postfix = '', $add_str = '', $show_what = 'ymd', $show_text = 1, $translate = 1)
                            {
                                if (is_array($selected)) {
                                    $extra = (array) $extra + $name;
                                    $selected = $extra['selected'];
                        Severity: Minor
                        Found in plugins/html/classes/html/yf_html_datetime.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 api_url has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function api_url($options = null, $request_options = null)
                            {
                                // import options
                                is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                                if ( ! empty($_url)) {
                        Severity: Minor
                        Found in plugins/payment/classes/yf_payment_api__provider_remote.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 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function _form($data, $options = null)
                            {
                                if ( ! $this->ENABLE) {
                                    return  null;
                                }
                        Severity: Minor
                        Found in plugins/payment/classes/yf_payment_api__provider_ecommpay.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

                        Severity
                        Category
                        Status
                        Source
                        Language