Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1584-1587 (lines=4) @@
1581
1582
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1583
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1584
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1585
        $invoice_id     = (int)$_GET['invoice-id'];
1586
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1587
    }
1588
1589
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1590
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1669-1672 (lines=4) @@
1666
1667
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1668
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1669
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1670
            $invoice_id     = (int)$_GET['invoice-id'];
1671
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1672
        }
1673
        
1674
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1675
            if ( $invoice->needs_payment() ) {