Code Duplication    Length = 9-9 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 243-251 (lines=9) @@
240
        return $invoice;
241
    }
242
    
243
    if ( $wp_error ) {
244
        if ( is_wp_error( $invoice ) ) {
245
            return $invoice;
246
        } else {
247
            return new WP_Error( 'wpinv_insert_invoice_error', __( 'Error in insert invoice.', 'invoicing' ) );
248
        }
249
    } else {
250
        return 0;
251
    }
252
}
253
254
function wpinv_update_invoice( $invoice_data = array(), $wp_error = false ) {
@@ 423-431 (lines=9) @@
420
    $invoice->save();
421
    
422
    if ( empty( $invoice->ID ) || is_wp_error( $invoice ) ) {
423
        if ( $wp_error ) {
424
            if ( is_wp_error( $invoice ) ) {
425
                return $invoice;
426
            } else {
427
                return new WP_Error( 'wpinv_update_invoice_error', __( 'Error in update invoice.', 'invoicing' ) );
428
            }
429
        } else {
430
            return 0;
431
        }
432
    }
433
434
    // Add private note