Code Duplication    Length = 4-4 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1827-1830 (lines=4) @@
1824
1825
    $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1826
    $user_can_view = wpinv_can_view_receipt( $invoice_key );
1827
    if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1828
        $invoice_id     = (int)$_GET['invoice-id'];
1829
        $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1830
    }
1831
1832
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
1833
    if ( ! $user_can_view && ! empty( $invoice_key ) && ! is_user_logged_in() ) {
@@ 1912-1915 (lines=4) @@
1909
1910
        $invoice_id    = wpinv_get_invoice_id_by_key( $invoice_key );
1911
        $user_can_view = wpinv_can_view_receipt( $invoice_key );
1912
        if ( $user_can_view && isset( $_GET['invoice-id'] ) ) {
1913
            $invoice_id     = (int)$_GET['invoice-id'];
1914
            $user_can_view  = $invoice_key == wpinv_get_payment_key( (int)$_GET['invoice-id'] ) ? true : false;
1915
        }
1916
        
1917
        if ( $invoice_id && $user_can_view && ( $invoice = wpinv_get_invoice( $invoice_id ) ) ) {
1918
            if ( $invoice->needs_payment() ) {