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

@@ 2027-2032 (lines=6) @@
2024
        }
2025
        
2026
        $has_subscription = false;
2027
        foreach( $this->cart_details as $cart_item ) {
2028
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2029
                $has_subscription = true;
2030
                break;
2031
            }
2032
        }
2033
        
2034
        if ( count( $this->cart_details ) > 1 ) {
2035
            $has_subscription = false;
@@ 2060-2065 (lines=6) @@
2057
            return $item;
2058
        }
2059
        
2060
        foreach( $this->cart_details as $cart_item ) {
2061
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2062
                $item = $cart_item['id'];
2063
                break;
2064
            }
2065
        }
2066
        
2067
        if ( $object ) {
2068
            $item = $item ? new WPInv_Item( $item ) : NULL;