Code Duplication    Length = 26-30 lines in 2 locations

includes/class-wpinv-invoice.php 2 locations

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