imagecms/ImageCMS

View on GitHub
application/modules/payment_method_liqpay/payment_method_liqpay.php

Summary

Maintainability
D
2 days
Test Coverage

Method getForm has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getForm($param) {
        $payment_method_id = $param->getPaymentMethod();
        $key = $payment_method_id . '_' . $this->moduleName;
        $paySettings = $this->getPaymentSettings($key);

Severity: Minor
Found in application/modules/payment_method_liqpay/payment_method_liqpay.php - About 1 hr to fix

Method checkPaid has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkPaid($param) {
        $ci = &get_instance();

        $order_id = $param['order_id'];
        $userOrder = $ci->db->where('id', $order_id)
Severity: Minor
Found in application/modules/payment_method_liqpay/payment_method_liqpay.php - About 1 hr to fix

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

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

Severity: Minor
Found in application/modules/payment_method_liqpay/payment_method_liqpay.php - About 1 hr to fix

Function checkPaid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkPaid($param) {
        $ci = &get_instance();

        $order_id = $param['order_id'];
        $userOrder = $ci->db->where('id', $order_id)
Severity: Minor
Found in application/modules/payment_method_liqpay/payment_method_liqpay.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 8 locations. Consider refactoring.
Open

    private function successPaid($order_id, $userOrder) {
        $ci = &get_instance();
        $amount = $ci->db->select('amout')
            ->get_where('users', ['id' => $userOrder->user_id]);

application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 194..230
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 202..239
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 362..399
application/modules/payment_method_paypal/payment_method_paypal.php on lines 200..237
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 291..328
application/modules/payment_method_walletone/payment_method_walletone.php on lines 255..288
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 249..286

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

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

    public function _deinstall() {
        $ci = &get_instance();

        $result = $ci->db->where('payment_system_name', $this->moduleName)
            ->update(
application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 246..266
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 255..275
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 415..435
application/modules/payment_method_paypal/payment_method_paypal.php on lines 253..273
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 344..364
application/modules/payment_method_walletone/payment_method_walletone.php on lines 304..324
application/modules/payment_method_webmoney/payment_method_webmoney.php on lines 252..272
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 302..322

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

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

    public function getAdminForm($id, $payName = null) {
        if (!$this->dx_auth->is_admin()) {
            redirect('/');
            exit;
        }
application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 49..64
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 49..64
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 49..64
application/modules/payment_method_paypal/payment_method_paypal.php on lines 50..65
application/modules/payment_method_privat24/payment_method_privat24.php on lines 57..72
application/modules/payment_method_robokassa/payment_method_robokassa.php on lines 49..64
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 49..64
application/modules/payment_method_webmoney/payment_method_webmoney.php on lines 49..64
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 49..64

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

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

    public function convert($price, $currencyId) {
        if ($currencyId == \Currency\Currency::create()->getMainCurrency()->getId()) {
            $return['price'] = $price;
            $return['code'] = \Currency\Currency::create()->getMainCurrency()->getCode();
            return $return;
application/modules/payment_method_2checkout/payment_method_2checkout.php on lines 68..78
application/modules/payment_method_interkassa/payment_method_interkassa.php on lines 68..78
application/modules/payment_method_oschadbank/payment_method_oschadbank.php on lines 68..78
application/modules/payment_method_paypal/payment_method_paypal.php on lines 69..79
application/modules/payment_method_robokassa/payment_method_robokassa.php on lines 68..78
application/modules/payment_method_sberbank/payment_method_sberbank.php on lines 68..78
application/modules/payment_method_walletone/payment_method_walletone.php on lines 79..89
application/modules/payment_method_webmoney/payment_method_webmoney.php on lines 68..78
application/modules/payment_method_yakassa/payment_method_yakassa.php on lines 68..78

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

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