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

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