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

@@ 291-298 (lines=8) @@
288
        $add_period         = $interval . ' ' . $period;
289
        $trial_period       = '';
290
291
        if ( $invoice->is_free_trial() ) {
292
            $status         = 'trialling';
293
            $trial_period   = $item->get_trial_period( true );
294
            $free_interval  = $item->get_trial_interval();
295
            $trial_period   = $free_interval . ' ' . $trial_period;
296
297
            $add_period     = $trial_period;
298
        }
299
300
        $expiration         = date_i18n( 'Y-m-d H:i:s', strtotime( '+' . $add_period  . ' 23:59:59', strtotime( $invoice_date ) ) );
301