Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1873-1876 (lines=4) @@
1870
1871
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1872
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1873
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1874
        $invoice_id     = (int)$_GET['invoice-id'];
1875
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1876
    }
1877
1878
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1879
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1968-1971 (lines=4) @@
1965
1966
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1967
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1968
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1969
            $invoice_id     = (int)$_GET['invoice-id'];
1970
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1971
        }
1972
        
1973
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1974
            if ( $invoice->needs_payment() ) {