gocodebox/lifterlms

View on GitHub
includes/functions/llms.functions.order.php

Summary

Maintainability
C
1 day
Test Coverage
A
97%

Method llms_setup_pending_order has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function llms_setup_pending_order( $data = array() ) {

    /**
     * Filters the order data before setting up the pending order.
     *
Severity: Major
Found in includes/functions/llms.functions.order.php - About 3 hrs to fix

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

    function llms_setup_pending_order( $data = array() ) {
    
        /**
         * Filters the order data before setting up the pending order.
         *
    Severity: Minor
    Found in includes/functions/llms.functions.order.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

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

    function llms_can_gateway_be_used_for_plan_or_order( $gateway_id, $plan_or_order, $wp_err = false, $enabled_only = true ) {
    
        $can_use = true;
    
        $plan_or_order = is_numeric( $plan_or_order ) ? llms_get_post( $plan_or_order ) : $plan_or_order;
    Severity: Minor
    Found in includes/functions/llms.functions.order.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

    Avoid too many return statements within this method.
    Open

                return $err;
    Severity: Major
    Found in includes/functions/llms.functions.order.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $err;
      Severity: Major
      Found in includes/functions/llms.functions.order.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $err;
        Severity: Major
        Found in includes/functions/llms.functions.order.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $err;
          Severity: Major
          Found in includes/functions/llms.functions.order.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $person_id;
            Severity: Major
            Found in includes/functions/llms.functions.order.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $gateway_error;
              Severity: Major
              Found in includes/functions/llms.functions.order.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return apply_filters( 'llms_after_setup_pending_order', compact( 'person', 'plan', 'gateway', 'coupon' ), $data );
                Severity: Major
                Found in includes/functions/llms.functions.order.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $err;
                  Severity: Major
                  Found in includes/functions/llms.functions.order.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status