Code Duplication    Length = 6-6 lines in 2 locations

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

@@ 699-704 (lines=6) @@
696
	 */
697
	public static function activate_module( $data ) {
698
		if ( Jetpack::is_module( $data['slug'] ) ) {
699
			if ( Jetpack::activate_module( $data['slug'], false, false ) ) {
700
				return rest_ensure_response( array(
701
					'code' 	  => 'success',
702
					'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ),
703
				) );
704
			}
705
			return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) );
706
		}
707
@@ 973-978 (lines=6) @@
970
			if ( ! Jetpack::is_module_active( $data['slug'] ) ) {
971
				return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) );
972
			}
973
			if ( Jetpack::deactivate_module( $data['slug'] ) ) {
974
				return rest_ensure_response( array(
975
					'code' 	  => 'success',
976
					'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ),
977
				) );
978
			}
979
			return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) );
980
		}
981