Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1359-1362 (lines=4) @@
1356
1357
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1358
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1359
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1360
        $invoice_id     = (int)$_GET['invoice-id'];
1361
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1362
    }
1363
1364
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1365
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1444-1447 (lines=4) @@
1441
1442
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1443
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1444
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1445
            $invoice_id     = (int)$_GET['invoice-id'];
1446
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1447
        }
1448
        
1449
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1450
            if ( $invoice->needs_payment() ) {