Code Duplication    Length = 6-7 lines in 2 locations

_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 1 location

@@ 247-252 (lines=6) @@
244
			}
245
		}
246
247
		if ( empty( $failed ) ) {
248
			return rest_ensure_response( array(
249
				'code' 	  => 'success',
250
				'message' => esc_html__( 'All modules activated.', 'jetpack' ),
251
			) );
252
		}
253
254
		$error = '';
255

_inc/lib/class.core-rest-api-endpoints.php 1 location

@@ 1660-1666 (lines=7) @@
1657
		}
1658
1659
		// If all Jumpstart modules were activated
1660
		if ( empty( $result['failed_modules'] ) ) {
1661
			return rest_ensure_response( array(
1662
				'code' 	  => 'success',
1663
				'message' => esc_html__( 'Jumpstart done.', 'jetpack' ),
1664
				'data'    => $result,
1665
			) );
1666
		}
1667
1668
		return new WP_Error( 'jumpstart_failed', esc_html( sprintf( _n( 'Jumpstart failed activating this module: %s.', 'Jumpstart failed activating these modules: %s.', count( $result['failed_modules'] ), 'jetpack' ), join( ', ', $result['failed_modules'] ) ) ), array( 'status' => 400 ) );
1669
	}