Code Duplication    Length = 6-6 lines in 3 locations

includes/wpinv-invoice-functions.php 1 location

@@ 881-886 (lines=6) @@
878
    }
879
    
880
    $has_subscription = false;
881
    foreach( $cart_items as $cart_item ) {
882
        if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
883
            $has_subscription = true;
884
            break;
885
        }
886
    }
887
    
888
    return apply_filters( 'wpinv_cart_has_recurring_item', $has_subscription, $cart_items );
889
}

includes/class-wpinv-invoice.php 2 locations

@@ 2043-2048 (lines=6) @@
2040
        }
2041
        
2042
        $has_subscription = false;
2043
        foreach( $this->cart_details as $cart_item ) {
2044
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2045
                $has_subscription = true;
2046
                break;
2047
            }
2048
        }
2049
        
2050
        if ( count( $this->cart_details ) > 1 ) {
2051
            $has_subscription = false;
@@ 2076-2081 (lines=6) @@
2073
            return $item;
2074
        }
2075
        
2076
        foreach( $this->cart_details as $cart_item ) {
2077
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2078
                $item = $cart_item['id'];
2079
                break;
2080
            }
2081
        }
2082
        
2083
        if ( $object ) {
2084
            $item = $item ? new WPInv_Item( $item ) : NULL;