Showing 4,217 of 4,217 total issues

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 215.

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

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

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

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

Refactorings

Further Reading

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

    public function manufacturers()
    {
        return table('SELECT * FROM ' . db('shop_manufacturers'), [
                'custom_fields' => ['num_products' => 'SELECT manufacturer_id, COUNT(*) AS num FROM ' . db('shop_products') . ' GROUP BY manufacturer_id'],
                'filter' => $_SESSION[$_GET['object'] . '__manufacturers'],
plugins/shop/admin_modules/manage_shop/yf_manage_shop_suppliers.class.php on lines 5..21

Duplicated Code

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

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

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

Tuning

This issue has a mass of 215.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 215.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 215.

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

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

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

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

Refactorings

Further Reading

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

    public function suppliers()
    {
        return table('SELECT * FROM ' . db('shop_suppliers'), [
                'custom_fields' => ['num_products' => 'SELECT supplier_id, COUNT(*) AS num FROM ' . db('shop_products') . ' GROUP BY supplier_id'],
                'filter' => $_SESSION[$_GET['object'] . '__suppliers'],
plugins/shop/admin_modules/manage_shop/yf_manage_shop_manufacturers.class.php on lines 11..27

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

Method api_payout has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function api_payout($options = null)
    {
        if ( ! $this->ENABLE) {
            return  null;
        }

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

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

      Method balance has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        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

        Function error_handler has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function error_handler($error_type, $error_msg, $error_file, $error_line)
            {
                // quickly turn off notices logging
                if ($this->NO_NOTICES && ($error_type == E_NOTICE || $error_type == E_USER_NOTICE)) {
                    return true;
        Severity: Minor
        Found in plugins/sys/classes/yf_core_errors.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 having has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function having()
            {
                $sql = '';
                $where = func_get_args();
                if ( ! count((array) $where)) {
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_query_builder_driver.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 order_by has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function order_by()
            {
                $sql = '';
                $items = func_get_args();
                $count = count((array) $items);
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_query_builder_driver.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 show has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function show()
            {
                $i = preg_replace('~[^a-z0-9_-]+~ims', '', trim($_GET['i'])); // instance
                $g = preg_replace('~[^a-z0-9_-]+~ims', '', trim($_GET['g'])); // group
                $t = preg_replace('~[^a-z0-9_-]+~ims', '', trim($_GET['t'])); // type
        Severity: Minor
        Found in plugins/redis/admin_modules/yf_manage_redis.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 _upload_item__import_action_test has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _upload_item__import_action_test($options)
            {
                $_ = $options;
                $fields = $_['fields'];
                $keys = $_['keys'];

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

            public function _get_grid($data = [])
            {
                $rows = [];
                foreach ((array) $data as $row_id => $row_items) {
                    $cols = '';
        Severity: Minor
        Found in plugins/dashboards/admin_modules/yf_manage_dashboards2.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 _get_grid has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _get_grid($data = [])
            {
                foreach ((array) $data as $row_id => $row_items) {
                    $cols = '';
                    if (isset($row_items['cols']) && is_array($row_items['cols'])) {
        Severity: Minor
        Found in plugins/dashboards/classes/yf_dashboards2.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 _do_check_data_is_valid has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _do_check_data_is_valid($rules = [], &$data)
            {
                $validate_ok = true;
                $_all = '__all__';
                if (isset($rules[$_all])) {
        Severity: Minor
        Found in classes/yf_validate.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

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

                    'visa_p2p_tasprivat_uah' => [
                        'title' => 'Visa (Privat24, UAH)',
                        'icon' => 'visa',
                        'request_option' => [
                            // 'paywayId' => '52e7f883e4ae1a2406000000', // visa_p2p_privat_uah
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 232..289
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 292..349
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 352..409

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

        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

                    'visa_p2p_tasnotprivat_uah' => [
                        'title' => 'Visa (UAH)',
                        'icon' => 'visa',
                        'request_option' => [
                            // 'paywayId' => '52ef9b77e4ae1a3008000000', // visa_p2p_notprivat_uah
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 172..229
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 292..349
        plugins/payment/classes/yf_payment_api__provider_interkassa.class.php on lines 352..409

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

        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