Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1837-1840 (lines=4) @@
1834
1835
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1836
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1837
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1838
        $invoice_id     = (int)$_GET['invoice-id'];
1839
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1840
    }
1841
1842
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1843
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1928-1931 (lines=4) @@
1925
1926
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1927
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1928
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1929
            $invoice_id     = (int)$_GET['invoice-id'];
1930
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1931
        }
1932
        
1933
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1934
            if ( $invoice->needs_payment() ) {