gocodebox/lifterlms

View on GitHub
includes/controllers/class.llms.controller.orders.php

Summary

Maintainability
C
1 day
Test Coverage
A
91%

Method recurring_charge has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function recurring_charge( $order_id ) {

        // Make sure the order still exists.
        $order = llms_get_post( $order_id );
        if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
Severity: Major
Found in includes/controllers/class.llms.controller.orders.php - About 2 hrs to fix

    File class.llms.controller.orders.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Order processing and related actions controller.
     *
     * @package LifterLMS/Controllers/Classes
    Severity: Minor
    Found in includes/controllers/class.llms.controller.orders.php - About 2 hrs to fix

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

          private function validate_selected_gateway( $gateway_id, $plan ) {
      
              $gateway = llms()->payment_gateways()->get_gateway_by_id( $gateway_id );
              $err     = new WP_Error();
      
      
      Severity: Minor
      Found in includes/controllers/class.llms.controller.orders.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 recurring_charge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function recurring_charge( $order_id ) {
      
              // Make sure the order still exists.
              $order = llms_get_post( $order_id );
              if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
      Severity: Minor
      Found in includes/controllers/class.llms.controller.orders.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

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in includes/controllers/class.llms.controller.orders.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return false;
        Severity: Major
        Found in includes/controllers/class.llms.controller.orders.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $gateway;
          Severity: Major
          Found in includes/controllers/class.llms.controller.orders.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in includes/controllers/class.llms.controller.orders.php - About 30 mins to fix

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

                  public function error_order( $order ) {
              
                      $order = is_a( $order, 'LLMS_Order' ) ? $order : llms_get_post( $order );
                      if ( ! ( $order && is_a( $order, 'LLMS_Order' ) ) ) {
                          return;
              Severity: Minor
              Found in includes/controllers/class.llms.controller.orders.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