Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-discount-functions.php 2 locations

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