Code Duplication    Length = 26-30 lines in 2 locations

includes/class-wpinv-invoice.php 2 locations

@@ 2311-2336 (lines=26) @@
2308
        return $status_label;
2309
    }
2310
    
2311
    public function get_subscription_period( $full = false ) {
2312
        $period = $this->get_meta( '_wpinv_subscr_period', true );
2313
        
2314
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
2315
            $period = 'D';
2316
        }
2317
        
2318
        if ( $full ) {
2319
            switch( $period ) {
2320
                case 'D':
2321
                    $period = 'day';
2322
                break;
2323
                case 'W':
2324
                    $period = 'week';
2325
                break;
2326
                case 'M':
2327
                    $period = 'month';
2328
                break;
2329
                case 'Y':
2330
                    $period = 'year';
2331
                break;
2332
            }
2333
        }
2334
        
2335
        return $period;
2336
    }
2337
    
2338
    public function get_subscription_interval() {
2339
        $interval = (int)$this->get_meta( '_wpinv_subscr_interval', true );
@@ 2348-2377 (lines=30) @@
2345
        return $interval;
2346
    }
2347
    
2348
    public function get_subscription_trial_period( $full = false ) {
2349
        if ( !$this->is_free_trial() ) {
2350
            return '';
2351
        }
2352
        
2353
        $period = $this->get_meta( '_wpinv_subscr_trial_period', true );
2354
        
2355
        if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) {
2356
            $period = 'D';
2357
        }
2358
        
2359
        if ( $full ) {
2360
            switch( $period ) {
2361
                case 'D':
2362
                    $period = 'day';
2363
                break;
2364
                case 'W':
2365
                    $period = 'week';
2366
                break;
2367
                case 'M':
2368
                    $period = 'month';
2369
                break;
2370
                case 'Y':
2371
                    $period = 'year';
2372
                break;
2373
            }
2374
        }
2375
        
2376
        return $period;
2377
    }
2378
    
2379
    public function get_subscription_trial_interval() {
2380
        if ( !$this->is_free_trial() ) {