Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-template-functions.php 2 locations

@@ 2156-2160 (lines=5) @@
2153
    $error = __( 'This invoice is only viewable by clicking on the invoice link that sent to you via email.', 'invoicing' );
2154
    if ( !empty( $invoice->ID ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
2155
        if ( is_user_logged_in() ) {
2156
            if ( wpinv_require_login_to_checkout() ) {
2157
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2158
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2159
                }
2160
            }
2161
        } else {
2162
            if ( wpinv_require_login_to_checkout() ) {
2163
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
@@ 2161-2167 (lines=7) @@
2158
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2159
                }
2160
            }
2161
        } else {
2162
            if ( wpinv_require_login_to_checkout() ) {
2163
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2164
                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
2165
                }
2166
            }
2167
        }
2168
    } else {
2169
        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
2170
    }