Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-template-functions.php 2 locations

@@ 2115-2119 (lines=5) @@
2112
    $error = __( 'This invoice is only viewable by clicking on the invoice link that sent to you via email.', 'invoicing' );
2113
    if ( !empty( $invoice->ID ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
2114
        if ( is_user_logged_in() ) {
2115
            if ( wpinv_require_login_to_checkout() ) {
2116
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2117
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2118
                }
2119
            }
2120
        } else {
2121
            if ( wpinv_require_login_to_checkout() ) {
2122
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
@@ 2120-2126 (lines=7) @@
2117
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2118
                }
2119
            }
2120
        } else {
2121
            if ( wpinv_require_login_to_checkout() ) {
2122
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2123
                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
2124
                }
2125
            }
2126
        }
2127
    } else {
2128
        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
2129
    }