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' ) ) {
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
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();
- Read upRead up
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' ) ) {
- Read upRead up
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;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $gateway;
Avoid too many return
statements within this method. Open
return true;
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;
- Read upRead up
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"