Code Duplication    Length = 3-5 lines in 2 locations

includes/wpinv-template-functions.php 1 location

@@ 400-402 (lines=3) @@
397
    }
398
    
399
    $options = '';
400
    if( !empty( $args['onchange'] ) ) {
401
        $options .= ' onchange="' . esc_attr( $args['onchange'] ) . '"';
402
    }
403
    
404
    if( !empty( $args['required'] ) ) {
405
        $options .= ' required="required"';

includes/admin/register-settings.php 1 location

@@ 1173-1177 (lines=5) @@
1170
		$chosen = '';
1171
	}
1172
    
1173
    if( !empty( $args['onchange'] ) ) {
1174
        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
1175
    } else {
1176
        $onchange = '';
1177
    }
1178
1179
	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" ' . $chosen . 'data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1180