Code Duplication    Length = 3-7 lines in 3 locations

class.jetpack-cli.php 1 location

@@ 937-943 (lines=7) @@
934
				Settings::update_settings( $sync_settings );
935
936
				// Convert comma-delimited string of modules to an array
937
				if ( ! empty( $assoc_args['modules'] ) ) {
938
					$modules = array_map( 'trim', explode( ',', $assoc_args['modules'] ) );
939
940
					// Convert the array so that the keys are the module name and the value is true to indicate
941
					// that we want to sync the module
942
					$modules = array_map( '__return_true', array_flip( $modules ) );
943
				}
944
945
				foreach ( array( 'posts', 'comments', 'users' ) as $module_name ) {
946
					if (

json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php 1 location

@@ 31-33 (lines=3) @@
28
29
		// convert list of modules in comma-delimited format into an array
30
		// of "$modulename => true"
31
		if ( isset( $args['modules'] ) && ! empty( $args['modules'] ) ) {
32
			$modules = array_map( '__return_true', array_flip( array_map( 'trim', explode( ',', $args['modules'] ) ) ) );
33
		}
34
35
		foreach ( array( 'posts', 'comments', 'users' ) as $module_name ) {
36
			if ( 'users' === $module_name && isset( $args[ $module_name ] ) && 'initial' === $args[ $module_name ] ) {

modules/contact-form/grunion-contact-form.php 1 location

@@ 3235-3237 (lines=3) @@
3232
		if ( ! empty( $attributes['options'] ) && is_string( $attributes['options'] ) ) {
3233
			$attributes['options'] = array_map( 'trim', explode( ',', $attributes['options'] ) );
3234
3235
			if ( ! empty( $attributes['values'] ) && is_string( $attributes['values'] ) ) {
3236
				$attributes['values'] = array_map( 'trim', explode( ',', $attributes['values'] ) );
3237
			}
3238
		}
3239
3240
		if ( $form ) {