Code Duplication    Length = 26-30 lines in 2 locations

includes/class-wpinv-invoice.php 2 locations

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