Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1882-1885 (lines=4) @@
1879
1880
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1881
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1882
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1883
        $invoice_id     = (int)$_GET['invoice-id'];
1884
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1885
    }
1886
1887
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1888
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1977-1980 (lines=4) @@
1974
1975
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1976
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1977
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1978
            $invoice_id     = (int)$_GET['invoice-id'];
1979
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1980
        }
1981
        
1982
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1983
            if ( $invoice->needs_payment() ) {