Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1852-1855 (lines=4) @@
1849
1850
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1851
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1852
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1853
        $invoice_id     = (int)$_GET['invoice-id'];
1854
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1855
    }
1856
1857
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1858
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1947-1950 (lines=4) @@
1944
1945
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1946
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1947
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1948
            $invoice_id     = (int)$_GET['invoice-id'];
1949
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1950
        }
1951
        
1952
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1953
            if ( $invoice->needs_payment() ) {