Code Duplication    Length = 6-6 lines in 2 locations

_inc/lib/class.core-rest-api-endpoints.php 2 locations

@@ 715-720 (lines=6) @@
712
	 */
713
	public static function activate_module( $data ) {
714
		if ( Jetpack::is_module( $data['slug'] ) ) {
715
			if ( Jetpack::activate_module( $data['slug'], false, false ) ) {
716
				return rest_ensure_response( array(
717
					'code' 	  => 'success',
718
					'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ),
719
				) );
720
			}
721
			return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) );
722
		}
723
@@ 988-993 (lines=6) @@
985
			if ( ! Jetpack::is_module_active( $data['slug'] ) ) {
986
				return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) );
987
			}
988
			if ( Jetpack::deactivate_module( $data['slug'] ) ) {
989
				return rest_ensure_response( array(
990
					'code' 	  => 'success',
991
					'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ),
992
				) );
993
			}
994
			return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) );
995
		}
996