Code Duplication    Length = 8-9 lines in 2 locations

includes/admin/wpinv-upgrade-functions.php 1 location

@@ 137-145 (lines=9) @@
134
        $add_period             = $interval . ' ' . $period;
135
        $trial_period           = '';
136
137
        if ( $invoice->is_free_trial() ) {
138
            $trial_period       = $item->get_trial_period( true );
139
            $free_interval      = $item->get_trial_interval();
140
            $trial_period       = $free_interval . ' ' . $trial_period;
141
142
            if ( empty( $last_payment ) ) {
143
                $add_period     = $trial_period;
144
            }
145
        }
146
147
        $expiration             = date_i18n( 'Y-m-d H:i:s', strtotime( '+' . $add_period  . ' 23:59:59', strtotime( $invoice_date ) ) );
148
        if ( strtotime( $expiration ) <  strtotime( date_i18n( 'Y-m-d' ) ) ) {

includes/class-wpinv-subscriptions.php 1 location

@@ 307-314 (lines=8) @@
304
        $add_period         = $interval . ' ' . $period;
305
        $trial_period       = '';
306
307
        if ( $invoice->is_free_trial() ) {
308
            $status         = 'trialling';
309
            $trial_period   = $item->get_trial_period( true );
310
            $free_interval  = $item->get_trial_interval();
311
            $trial_period   = $free_interval . ' ' . $trial_period;
312
313
            $add_period     = $trial_period;
314
        }
315
316
        $expiration         = date_i18n( 'Y-m-d H:i:s', strtotime( '+' . $add_period  . ' 23:59:59', strtotime( $invoice_date ) ) );
317