skyverge/wc-plugin-framework

View on GitHub
woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php

Summary

Maintainability
D
1 day
Test Coverage

Function process_release_payment has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_release_payment( $order ) {

        try {

            // set order defaults

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

    public function get_order( $order ) {

        // bail if order doesn't contain a pre-order
        if ( ! \WC_Pre_Orders_Order::order_contains_pre_order( $order ) ) {
            return $order;

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

    public function process_release_payment( $order ) {

        try {

            // set order defaults

    Method get_order has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_order( $order ) {
    
            // bail if order doesn't contain a pre-order
            if ( ! \WC_Pre_Orders_Order::order_contains_pre_order( $order ) ) {
                return $order;

      Function maybe_force_tokenization has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function maybe_force_tokenization( $force_tokenization ) {
      
              $pay_page_pre_order = false;
      
              // pay page with pre-order?

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

          public function process_payment( $result, $order_id ) {
      
              // processing pre-order
              if ( \WC_Pre_Orders_Order::order_contains_pre_order( $order_id ) &&
                   \WC_Pre_Orders_Order::order_requires_payment_tokenization( $order_id ) ) {

      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