Code Duplication    Length = 26-30 lines in 2 locations

includes/class-wpinv-invoice.php 2 locations

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