Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-discount-functions.php 2 locations

@@ 516-520 (lines=5) @@
513
        // Large number that will never be reached
514
        $max_uses = wpinv_get_discount_max_uses( $code_id );
515
        // Should never be greater than, but just in case
516
        if ( $uses >= $max_uses && ! empty( $max_uses ) ) {
517
            // Discount is maxed out
518
            wpinv_set_error( 'wpinv-discount-error', __( 'This discount has reached its maximum usage.', 'invoicing' ) );
519
            $return = true;
520
        }
521
    }
522
523
    return apply_filters( 'wpinv_is_discount_maxed_out', $return, $code_id );
@@ 644-650 (lines=7) @@
641
        $ret = true;
642
    }
643
644
    if( ! empty( $excluded_ps ) ) {
645
        // Check that there are items other than excluded ones in the cart
646
        if( $cart_ids == $excluded_ps ) {
647
            wpinv_set_error( 'wpinv-discount-error', __( 'This discount is not valid for the cart contents.', 'invoicing' ) );
648
            $ret = false;
649
        }
650
    }
651
652
    return (bool) apply_filters( 'wpinv_is_discount_item_req_met', $ret, $code_id, $condition );
653
}