Code Duplication    Length = 27-27 lines in 2 locations

includes/class-wpinv-item.php 2 locations

@@ 270-296 (lines=27) @@
267
268
    }
269
    
270
    public function get_recurring_period( $full = false ) {
271
        $period = get_post_meta( $this->ID, '_wpinv_recurring_period', true );
272
        
273
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
274
            $period = 'D';
275
        }
276
        
277
        if ( $full ) {
278
            switch( $period ) {
279
                case 'D':
280
                    $period = 'day';
281
                break;
282
                case 'W':
283
                    $period = 'week';
284
                break;
285
                case 'M':
286
                    $period = 'month';
287
                break;
288
                case 'Y':
289
                    $period = 'year';
290
                break;
291
            }
292
        }
293
294
        return apply_filters( 'wpinv_item_recurring_period', $period, $full, $this->ID );
295
    }
296
    
297
    public function get_recurring_interval() {
298
        $interval = (int)get_post_meta( $this->ID, '_wpinv_recurring_interval', true );
299
        
@@ 319-345 (lines=27) @@
316
        return apply_filters( 'wpinv_item_get_free_trial', $free_trial, $this->ID );
317
    }
318
    
319
    public function get_trial_period( $full = false ) {
320
        $period = get_post_meta( $this->ID, '_wpinv_trial_period', true );
321
        
322
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
323
            $period = 'D';
324
        }
325
        
326
        if ( $full ) {
327
            switch( $period ) {
328
                case 'D':
329
                    $period = 'day';
330
                break;
331
                case 'W':
332
                    $period = 'week';
333
                break;
334
                case 'M':
335
                    $period = 'month';
336
                break;
337
                case 'Y':
338
                    $period = 'year';
339
                break;
340
            }
341
        }
342
343
        return apply_filters( 'wpinv_item_trial_period', $period, $full, $this->ID );
344
    }
345
    
346
    public function get_trial_interval() {
347
        $interval = absint( get_post_meta( $this->ID, '_wpinv_trial_interval', true ) );
348