Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-template-functions.php 2 locations

@@ 2146-2150 (lines=5) @@
2143
    $error = __( 'This invoice is only viewable by clicking on the invoice link that sent to you via email.', 'invoicing' );
2144
    if ( !empty( $invoice->ID ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
2145
        if ( is_user_logged_in() ) {
2146
            if ( wpinv_require_login_to_checkout() ) {
2147
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2148
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2149
                }
2150
            }
2151
        } else {
2152
            if ( wpinv_require_login_to_checkout() ) {
2153
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
@@ 2151-2157 (lines=7) @@
2148
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2149
                }
2150
            }
2151
        } else {
2152
            if ( wpinv_require_login_to_checkout() ) {
2153
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2154
                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
2155
                }
2156
            }
2157
        }
2158
    } else {
2159
        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
2160
    }