Code Duplication    Length = 6-6 lines in 3 locations

includes/wpinv-invoice-functions.php 1 location

@@ 886-891 (lines=6) @@
883
    }
884
    
885
    $has_subscription = false;
886
    foreach( $cart_items as $cart_item ) {
887
        if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
888
            $has_subscription = true;
889
            break;
890
        }
891
    }
892
    
893
    return apply_filters( 'wpinv_cart_has_recurring_item', $has_subscription, $cart_items );
894
}

includes/class-wpinv-invoice.php 2 locations

@@ 2044-2049 (lines=6) @@
2041
        }
2042
        
2043
        $has_subscription = false;
2044
        foreach( $this->cart_details as $cart_item ) {
2045
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2046
                $has_subscription = true;
2047
                break;
2048
            }
2049
        }
2050
        
2051
        if ( count( $this->cart_details ) > 1 ) {
2052
            $has_subscription = false;
@@ 2087-2092 (lines=6) @@
2084
            return $item;
2085
        }
2086
        
2087
        foreach( $this->cart_details as $cart_item ) {
2088
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2089
                $item = $cart_item['id'];
2090
                break;
2091
            }
2092
        }
2093
        
2094
        if ( $object ) {
2095
            $item = $item ? new WPInv_Item( $item ) : NULL;