Code Duplication    Length = 13-17 lines in 2 locations

includes/class-wpinv-subscription.php 2 locations

@@ 352-368 (lines=17) @@
349
        do_action( 'wpinv_recurring_set_subscription_status', $this->id, $this->status, $this );
350
    }
351
352
    public function complete() {
353
        if ( 'cancelled' === $this->status ) {
354
            return;
355
        }
356
357
        $args = array(
358
            'status' => 'completed'
359
        );
360
361
        if ( $this->subscriptions_db->update( $this->id, $args ) ) {
362
            $this->add_note( sprintf( __( 'Status changed from %s to %s', 'invoicing' ), $this->status, 'completed' ) );
363
364
            $this->status = 'completed';
365
366
            do_action( 'wpinv_subscription_completed', $this->id, $this );
367
        }
368
    }
369
370
    public function expire( $check_expiration = false ) {
371
        $expiration = $this->expiration;
@@ 392-404 (lines=13) @@
389
        }
390
    }
391
392
    public function failing() {
393
        $args = array(
394
            'status' => 'failing'
395
        );
396
397
        if ( $this->subscriptions_db->update( $this->id, $args ) ) {
398
            $this->add_note( sprintf( __( 'Status changed from %s to %s', 'invoicing' ), $this->status, 'failing' ) );
399
400
            $this->status = 'failing';
401
402
            do_action( 'wpinv_subscription_failing', $this->id, $this );
403
        }
404
    }
405
406
    public function cancel() {
407
        if ( 'cancelled' === $this->status ) {