Code Duplication    Length = 6-6 lines in 3 locations

includes/class-wpinv-invoice.php 2 locations

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

includes/wpinv-invoice-functions.php 1 location

@@ 665-670 (lines=6) @@
662
    }
663
    
664
    $has_subscription = false;
665
    foreach( $cart_items as $cart_item ) {
666
        if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
667
            $has_subscription = true;
668
            break;
669
        }
670
    }
671
    
672
    return apply_filters( 'wpinv_cart_has_recurring_item', $has_subscription, $cart_items );
673
}