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

@@ 2049-2054 (lines=6) @@
2046
        }
2047
        
2048
        $has_subscription = false;
2049
        foreach( $this->cart_details as $cart_item ) {
2050
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2051
                $has_subscription = true;
2052
                break;
2053
            }
2054
        }
2055
        
2056
        if ( count( $this->cart_details ) > 1 ) {
2057
            $has_subscription = false;
@@ 2092-2097 (lines=6) @@
2089
            return $item;
2090
        }
2091
        
2092
        foreach( $this->cart_details as $cart_item ) {
2093
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2094
                $item = $cart_item['id'];
2095
                break;
2096
            }
2097
        }
2098
        
2099
        if ( $object ) {
2100
            $item = $item ? new WPInv_Item( $item ) : NULL;