Code Duplication    Length = 6-6 lines in 3 locations

includes/wpinv-invoice-functions.php 1 location

@@ 436-441 (lines=6) @@
433
    }
434
    
435
    $has_subscription = false;
436
    foreach( $cart_items as $cart_item ) {
437
        if ( !empty( $cart_item['id'] ) && wpinv_is_recurring_item( $cart_item['id'] )  ) {
438
            $has_subscription = true;
439
            break;
440
        }
441
    }
442
    
443
    return apply_filters( 'wpinv_cart_has_recurring_item', $has_subscription, $cart_items );
444
}

includes/class-wpinv-invoice.php 2 locations

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