Showing 4,217 of 4,217 total issues

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

    public function test_greater_than()
    {
        $this->assertTrue(_class('validate')->greater_than('12345'));
        $this->assertTrue(_class('validate')->greater_than('12345', ['param' => '0']));
        $this->assertFalse(_class('validate')->greater_than('4', ['param' => '5']));
Severity: Major
Found in .dev/tests/unit/class_validate_test.Test.php and 3 other locations - About 7 hrs to fix
.dev/tests/unit/class_validate_test.Test.php on lines 212..224
.dev/tests/unit/class_validate_test.Test.php on lines 225..237
.dev/tests/unit/class_validate_test.Test.php on lines 238..250

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

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 _process has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _process($params = [])
    {
        // THESE ARE REQUIRED!
        $SOURCE_ARRAY = $params['source_array'];
        $TABLE_NAME = $params['table_name'];
Severity: Major
Found in plugins/common/classes/common/yf_related_content.class.php - About 7 hrs to fix

    Method _request has 175 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _request($url, $post = null, $options = null)
        {
            // import options
            is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
            // options
    Severity: Major
    Found in plugins/api/classes/yf_api.class.php - About 7 hrs to fix

      yf_db_utils_helper_create_table has 50 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class yf_db_utils_helper_create_table
      {
          protected $utils = null;
          protected $db_name = '';
          protected $table_name = '';
      Severity: Minor
      Found in plugins/db/classes/db/yf_db_utils_helper_create_table.class.php - About 7 hrs to fix

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

                foreach ((array) _class('dir')->scan($dir_to_scan, true, $pattern_include) as $k => $v) {
                    $v = str_replace('//', '/', $v);
                    if (substr($v, -$yf_cls_ext_len) != YF_CLS_EXT) {
                        continue;
                    }
        plugins/sys/classes/core_api/yf_core_api_user_modules.class.php on lines 55..73

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

        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

                foreach ((array) _class('dir')->scan($dir_to_scan, true, $pattern_include) as $k => $v) {
                    $v = str_replace('//', '/', $v);
                    if (substr($v, -$yf_cls_ext_len) != YF_CLS_EXT) {
                        continue;
                    }
        plugins/sys/classes/core_api/yf_core_api_admin_modules.class.php on lines 57..75

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

        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 173 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_payout.class.php - About 6 hrs to fix

          Function _get_all_content_for_out has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

              public function _get_all_content_for_out($out_type, $params = [])
              {
                  $is_ajax = main()->is_ajax();
                  // Move down inlined content
                  $all_content = $this->get_content($out_type);
          Severity: Minor
          Found in plugins/assets/classes/yf_assets.class.php - About 6 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

          tpl_driver_yf_core_test has 49 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class tpl_driver_yf_core_test extends tpl_abstract
          {
              public function return_true($out = '')
              {
                  return $out ? (is_array($out) ? implode(',', $out) : $out) : 'true';
          Severity: Minor
          Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php - About 6 hrs to fix

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

            <?php
            
            _class('payment_api__provider_remote');
            
            class yf_payment_api__provider_privat24 extends yf_payment_api__provider_remote
            Severity: Minor
            Found in plugins/payment/classes/yf_payment_api__provider_privat24.class.php - About 6 hrs to fix

              Method _init has 169 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _init()
                  {
                      $this->supported_conds = [
                          'in' => function ($a) {
                              return ' IN( ' . _es($a['value']) . ' )';
              Severity: Major
              Found in plugins/table2/classes/table2/yf_table2_filter.class.php - About 6 hrs to fix

                Function html_out has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function html_out($out_type, $content_type, $str, $params = [])
                    {
                        if ( ! $out_type || ! $content_type || ! strlen($str)) {
                            return false;
                        }
                Severity: Minor
                Found in plugins/assets/classes/yf_assets.class.php - About 6 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 _cleanup_menu_items has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _cleanup_menu_items($menu_items = [])
                    {
                        $center_block_id = _class('graphics')->_get_center_block_id();
                
                        $out = [];
                Severity: Minor
                Found in plugins/sys/classes/yf_core_menu.class.php - About 6 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 168 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_payout.class.php - About 6 hrs to fix

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

                  <?php
                  
                  class yf_rewrite
                  {
                      public $DEFAULT_HOST = '';
                  Severity: Minor
                  Found in plugins/rewrite/classes/yf_rewrite.class.php - About 6 hrs to fix

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

                    <?php
                    
                    return [
                      7 => [
                        'id' => '7',
                    .dev/install/installer_data/db_tables_uk/forum_topics.data.php on lines 1..48

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

                    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

                    <?php
                    
                    return [
                      7 => [
                        'id' => '7',
                    .dev/install/installer_data/db_tables_ru/forum_topics.data.php on lines 1..48

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

                    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_array($path)) {
                                $_bulk_cmd = [];
                                foreach ((array) $path as $_path => $_new_owner) {
                                    $_path = _class('ssh')->_prepare_path($_path);
                                    if (substr_count($_path, '/') <= 1) {
                    Severity: Major
                    Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php and 1 other location - About 6 hrs to fix
                    plugins/ssh/classes/ssh/yf_ssh_files.class.php on lines 523..536

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

                    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_array($path)) {
                                $_bulk_cmd = [];
                                foreach ((array) $path as $_path => $_new_mode) {
                                    $_path = _class('ssh')->_prepare_path($_path);
                                    if (substr_count($_path, '/') <= 1) {
                    Severity: Major
                    Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php and 1 other location - About 6 hrs to fix
                    plugins/ssh/classes/ssh/yf_ssh_files.class.php on lines 562..575

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

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

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

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

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

                    Refactorings

                    Further Reading

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

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

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 215.

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

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

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

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

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language