Code Duplication    Length = 4-4 lines in 3 locations

includes/libraries/wpinv-euvat/class-wpinv-euvat.php 3 locations

@@ 747-750 (lines=4) @@
744
        $response = array();
745
        $response['success'] = false;
746
        
747
        if ( !current_user_can( 'manage_options' ) ) {
748
            $response['error'] = __( 'Invalid access!', 'invoicing' );
749
            wp_send_json( $response );
750
        }
751
        
752
        $vat_class_name = !empty( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : false;
753
        $vat_class_desc = !empty( $_POST['desc'] ) ? sanitize_text_field( $_POST['desc'] ) : false;
@@ 785-788 (lines=4) @@
782
        $response = array();
783
        $response['success'] = false;
784
        
785
        if ( !current_user_can( 'manage_options' ) || !isset( $_POST['class'] ) ) {
786
            $response['error'] = __( 'Invalid access!', 'invoicing' );
787
            wp_send_json( $response );
788
        }
789
        
790
        $vat_class = isset( $_POST['class'] ) && $_POST['class'] !== '' ? sanitize_text_field( $_POST['class'] ) : false;
791
        $vat_classes = (array)self::get_rate_classes();
@@ 820-823 (lines=4) @@
817
        $response['error']      = null;
818
        $response['data']       = null;
819
        
820
        if ( !current_user_can( 'manage_options' ) ) {
821
            $response['error'] = __( 'Invalid access!', 'invoicing' );
822
            wp_send_json( $response );
823
        }
824
        
825
        $group      = !empty( $_POST['group'] ) ? sanitize_text_field( $_POST['group'] ) : '';
826
        $euvatrates = self::request_euvatrates( $group );