tuhin18003/WooCommerce-AltCoin-Payment-Gateway

View on GitHub
core/frontend/functions/CsWapgAutoOrderConfirm.php

Summary

Maintainability
C
1 day
Test Coverage

Method track_coin has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function track_coin( $raw_data ) {
        global $woocommerce;

        $raw_data = $raw_data['form_data'];
        $data     = array();
Severity: Major
Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 5 hrs to fix

    Function track_coin has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function track_coin( $raw_data ) {
            global $woocommerce;
    
            $raw_data = $raw_data['form_data'];
            $data     = array();
    Severity: Minor
    Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 3 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

    Avoid too many return statements within this method.
    Open

                    return wp_send_json(
                        Util::notice_html(
                            array(
                                'error'    => true,
                                'response' => isset( $response->response ) ? $response->response : $response->message,
    Severity: Major
    Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return wp_send_json(
                          Util::notice_html(
                              array(
                                  'success'  => true,
                                  'response' => __( 'Thank you! Transaction completed successfully. Your order is processing right now!', 'woo-altcoin-payment-gateway' ),
      Severity: Major
      Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return wp_send_json(
                            Util::notice_html(
                                array(
                                    'success'  => false,
                                    'response' => $response_msg,
        Severity: Major
        Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return wp_send_json(
                          Util::notice_html(
                              array(
                                  'error'    => true,
                                  'response' => __( 'Cart information not found! Please uninstall the this plugin and install a fresh copy then upgrade your WooCommerce store. ', 'woo-altcoin-payment-gateway' ),
          Severity: Major
          Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return wp_send_json(
                                Util::notice_html(
                                    array(
                                        'success'              => false,
                                        // 'response' => __( 'Transaction on processing. Getting confirmation data..', 'woo-altcoin-payment-gateway' )
            Severity: Major
            Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return wp_send_json(
                              Util::notice_html(
                                  array(
                                      'error'    => true,
                                      'response' => __( 'Unable to retrieve rest api data from server. Please make sure your server allow to call rest api.', 'woo-altcoin-payment-gateway' ),
              Severity: Major
              Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status