skyverge/wc-plugin-framework

View on GitHub
woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php

Summary

Maintainability
D
2 days
Test Coverage

File class-sv-wc-payment-gateway-hosted.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce Payment Gateway Framework
 *
 * This source file is subject to the GNU General Public License v3.0
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 4 hrs to fix

    Function process_tokenization_response has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function process_tokenization_response( \WC_Order $order, $response ) {
    
            if ( is_callable( array( $response, 'get_customer_id' ) ) && $response->get_customer_id() ) {
                $order->customer_id = $response->get_customer_id();
            }
    Severity: Minor
    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 4 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

    SV_WC_Payment_Gateway_Hosted has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    #[\AllowDynamicProperties]
    abstract class SV_WC_Payment_Gateway_Hosted extends SV_WC_Payment_Gateway {
    
    
        /** @var string the WC API url, used for the IPN and/or redirect-back handler */
    Severity: Minor
    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 4 hrs to fix

      Method process_tokenization_response has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function process_tokenization_response( \WC_Order $order, $response ) {
      
              if ( is_callable( array( $response, 'get_customer_id' ) ) && $response->get_customer_id() ) {
                  $order->customer_id = $response->get_customer_id();
              }
      Severity: Major
      Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 2 hrs to fix

        Function process_transaction_response has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function process_transaction_response( $order, $response ) {
        
                if ( $response->transaction_approved() || $response->transaction_held() ) {
        
                    // if tokenization is supported, process any token data that might have come back in the response
        Severity: Minor
        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.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

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

            public function render_auto_post_form( \WC_Order $order, $request_params ) {
        
                $args = $this->get_auto_post_form_args( $order );
        
                // attempt to automatically submit the form and redirect
        Severity: Minor
        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 1 hr to fix

          Function handle_transaction_response_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle_transaction_response_request() {
          
                  $order    = null;
                  $response = null;
          
          
          Severity: Minor
          Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 55 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

          Function do_invalid_transaction_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function do_invalid_transaction_response( $order, $response ) {
          
                  if ( $response->is_ipn() ) {
          
                      status_header( 200 );
          Severity: Minor
          Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 35 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

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

              protected function get_payment_url( $order_id ) {
          
                  if ( $this->use_form_post() ) {
                      // the checkout pay page
                      $order = wc_get_order( $order_id );
          Severity: Minor
          Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.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

          There are no issues that match your filters.

          Category
          Status