Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1862-1865 (lines=4) @@
1859
1860
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1861
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1862
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1863
        $invoice_id     = (int)$_GET['invoice-id'];
1864
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1865
    }
1866
1867
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1868
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1957-1960 (lines=4) @@
1954
1955
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1956
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1957
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1958
            $invoice_id     = (int)$_GET['invoice-id'];
1959
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1960
        }
1961
        
1962
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1963
            if ( $invoice->needs_payment() ) {