Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1843-1846 (lines=4) @@
1840
1841
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1842
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1843
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1844
        $invoice_id     = (int)$_GET['invoice-id'];
1845
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1846
    }
1847
1848
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1849
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1938-1941 (lines=4) @@
1935
1936
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1937
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1938
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1939
            $invoice_id     = (int)$_GET['invoice-id'];
1940
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1941
        }
1942
        
1943
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1944
            if ( $invoice->needs_payment() ) {