Code Duplication    Length = 5-7 lines in 2 locations

includes/wpinv-template-functions.php 2 locations

@@ 2100-2104 (lines=5) @@
2097
    $error = __( 'This invoice is only viewable by clicking on the invoice link that sent to you via email.', 'invoicing' );
2098
    if ( !empty( $invoice->ID ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
2099
        if ( is_user_logged_in() ) {
2100
            if ( wpinv_require_login_to_checkout() ) {
2101
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2102
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2103
                }
2104
            }
2105
        } else {
2106
            if ( wpinv_require_login_to_checkout() ) {
2107
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
@@ 2105-2111 (lines=7) @@
2102
                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2103
                }
2104
            }
2105
        } else {
2106
            if ( wpinv_require_login_to_checkout() ) {
2107
                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2108
                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
2109
                }
2110
            }
2111
        }
2112
    } else {
2113
        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
2114
    }