Code Duplication    Length = 27-27 lines in 2 locations

includes/class-wpinv-item.php 2 locations

@@ 242-268 (lines=27) @@
239
240
    }
241
    
242
    public function get_recurring_period( $full = false ) {
243
        $period = get_post_meta( $this->ID, '_wpinv_recurring_period', true );
244
        
245
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
246
            $period = 'D';
247
        }
248
        
249
        if ( $full ) {
250
            switch( $period ) {
251
                case 'D':
252
                    $period = 'day';
253
                break;
254
                case 'W':
255
                    $period = 'week';
256
                break;
257
                case 'M':
258
                    $period = 'month';
259
                break;
260
                case 'Y':
261
                    $period = 'year';
262
                break;
263
            }
264
        }
265
266
        return apply_filters( 'wpinv_item_recurring_period', $period, $full, $this->ID );
267
268
    }
269
    
270
    public function get_recurring_interval() {
271
        $interval = (int)get_post_meta( $this->ID, '_wpinv_recurring_interval', true );
@@ 296-322 (lines=27) @@
293
294
    }
295
    
296
    public function get_trial_period( $full = false ) {
297
        $period = get_post_meta( $this->ID, '_wpinv_trial_period', true );
298
        
299
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
300
            $period = 'D';
301
        }
302
        
303
        if ( $full ) {
304
            switch( $period ) {
305
                case 'D':
306
                    $period = 'day';
307
                break;
308
                case 'W':
309
                    $period = 'week';
310
                break;
311
                case 'M':
312
                    $period = 'month';
313
                break;
314
                case 'Y':
315
                    $period = 'year';
316
                break;
317
            }
318
        }
319
320
        return apply_filters( 'wpinv_item_trial_period', $period, $full, $this->ID );
321
322
    }
323
    
324
    public function get_trial_interval() {
325
        $interval = absint( get_post_meta( $this->ID, '_wpinv_trial_interval', true ) );