Code Duplication    Length = 10-14 lines in 2 locations

class.jetpack-cli.php 1 location

@@ 938-951 (lines=14) @@
935
					$modules = array_map( '__return_true', array_flip( $modules ) );
936
				}
937
938
				foreach ( array( 'posts', 'comments', 'users' ) as $module_name ) {
939
					if (
940
						'users' === $module_name &&
941
						isset( $assoc_args[ $module_name ] ) &&
942
						'initial' === $assoc_args[ $module_name ]
943
					) {
944
						$modules[ 'users' ] = 'initial';
945
					} elseif ( isset( $assoc_args[ $module_name ] ) ) {
946
						$ids = explode( ',', $assoc_args[ $module_name ] );
947
						if ( count( $ids ) > 0 ) {
948
							$modules[ $module_name ] = $ids;
949
						}
950
					}
951
				}
952
953
				if ( empty( $modules ) ) {
954
					$modules = null;

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

@@ 23-32 (lines=10) @@
20
			$modules = array_map( '__return_true', array_flip( array_map( 'trim', explode( ',', $args['modules'] ) ) ) );
21
		}
22
23
		foreach ( array( 'posts', 'comments', 'users' ) as $module_name ) {
24
			if ( 'users' === $module_name && isset( $args[ $module_name ] ) && 'initial' === $args[ $module_name ] ) {
25
				$modules[ 'users' ] = 'initial';
26
			} elseif ( isset( $args[ $module_name ] ) ) {
27
				$ids = explode( ',', $args[ $module_name ] );
28
				if ( count( $ids ) > 0 ) {
29
					$modules[ $module_name ] = $ids;
30
				}
31
			}
32
		}
33
34
		if ( empty( $modules ) ) {
35
			$modules = null;