Code Duplication    Length = 6-6 lines in 3 locations

includes/wpinv-invoice-functions.php 1 location

@@ 660-665 (lines=6) @@
657
    }
658
    
659
    $has_subscription = false;
660
    foreach( $cart_items as $cart_item ) {
661
        if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
662
            $has_subscription = true;
663
            break;
664
        }
665
    }
666
    
667
    return apply_filters( 'wpinv_cart_has_recurring_item', $has_subscription, $cart_items );
668
}

includes/class-wpinv-invoice.php 2 locations

@@ 2031-2036 (lines=6) @@
2028
        }
2029
        
2030
        $has_subscription = false;
2031
        foreach( $this->cart_details as $cart_item ) {
2032
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2033
                $has_subscription = true;
2034
                break;
2035
            }
2036
        }
2037
        
2038
        if ( count( $this->cart_details ) > 1 ) {
2039
            $has_subscription = false;
@@ 2064-2069 (lines=6) @@
2061
            return $item;
2062
        }
2063
        
2064
        foreach( $this->cart_details as $cart_item ) {
2065
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2066
                $item = $cart_item['id'];
2067
                break;
2068
            }
2069
        }
2070
        
2071
        if ( $object ) {
2072
            $item = $item ? new WPInv_Item( $item ) : NULL;