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

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