Code Duplication    Length = 6-8 lines in 2 locations

json-endpoints/class.wpcom-json-api-site-settings-v1-2-endpoint.php 1 location

@@ 151-158 (lines=8) @@
148
	}
149
150
	public function update_locale( $value ) {
151
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
152
			$lang_id = get_lang_id_by_code( $value );
153
			if ( ! empty( $lang_id ) ) {
154
				if ( update_option( 'lang_id', $lang_id ) ) {
155
					return true;
156
				}
157
			}
158
		}
159
		return false;
160
	}
161

json-endpoints/class.wpcom-json-api-update-user-endpoint.php 1 location

@@ 102-107 (lines=6) @@
99
			return new WP_Error( 'invalid_input', 'A valid user ID must be specified.', 400 );
100
		}
101
102
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
103
			$domains = $this->domain_subscriptions_for_site_owned_by_user( $user_id );
104
			if ( ! empty( $domains ) ) {
105
				return new WP_Error( 'user_owns_domain_subscription', join( ', ', $domains ) );
106
			}
107
		}
108
109
    	if ( get_current_user_id() == $user_id ) {
110
			return new WP_Error( 'invalid_input', 'User can not remove or delete self through this endpoint.', 400 );