Code Duplication    Length = 6-6 lines in 3 locations

includes/class-wpinv-invoice.php 2 locations

@@ 2021-2026 (lines=6) @@
2018
        }
2019
        
2020
        $has_subscription = false;
2021
        foreach( $this->cart_details as $cart_item ) {
2022
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2023
                $has_subscription = true;
2024
                break;
2025
            }
2026
        }
2027
        
2028
        if ( count( $this->cart_details ) > 1 ) {
2029
            $has_subscription = false;
@@ 2054-2059 (lines=6) @@
2051
            return $item;
2052
        }
2053
        
2054
        foreach( $this->cart_details as $cart_item ) {
2055
            if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
2056
                $item = $cart_item['id'];
2057
                break;
2058
            }
2059
        }
2060
        
2061
        if ( $object ) {
2062
            $item = $item ? new WPInv_Item( $item ) : NULL;

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
}