Code Duplication    Length = 8-11 lines in 4 locations

admin/partials/menu/options-sections/integration-settings.php 1 location

@@ 86-93 (lines=8) @@
83
	// lets confirm the user has a valid API key stored.
84
	if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) {
85
		$list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists();
86
		if ( is_wp_error( $list_data ) ) {
87
			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
88
			$error_logging->maybe_write_to_log(
89
				$list_data->get_error_code(),
90
				__( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ),
91
				"Integration Settings Page"
92
			);
93
		}
94
	} else {
95
		?>
96
		<div class="inside">

admin/partials/view-user.php 1 location

@@ 51-59 (lines=9) @@
48
	}
49
50
	$list_data = $list_helper->get_list( $id );
51
	if ( is_wp_error( $list_data ) ) {
52
		$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
53
		$error_logging->maybe_write_to_log(
54
			$list_data->get_error_code(),
55
			__( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ),
56
			"View User Page"
57
		);
58
		continue;
59
	}
60
61
	$additional_lists[ $list_data['id'] ] = $list_data['name'];
62
}

public/classes/checkbox-integrations.php 2 locations

@@ 89-99 (lines=11) @@
86
			// If the error response is a 404, they are not subscribed.
87
			if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) {
88
				return false;
89
			} else {
90
				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
91
				$error_logging->maybe_write_to_log(
92
					$response->get_error_code(),
93
					__( 'Get Member Info', 'yikes-inc-easy-mailchimp-extender' ),
94
					'Checkbox Integrations Page'
95
				);
96
97
				// If there was some other error, let's just assume they're not subscribed.
98
				return false;
99
			}
100
		}
101
102
		// Look at the status from the API.
@@ 228-235 (lines=8) @@
225
			// Subscribe the user to the list via the API.
226
			$response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data );
227
228
			if ( is_wp_error( $response ) ) {
229
				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
230
				$error_logging->maybe_write_to_log(
231
					$response->get_error_code(),
232
					__( 'Checkbox Integration Subscribe User', 'yikes-inc-easy-mailchimp-extender' ),
233
					'Checkbox Integrations'
234
				);
235
			}
236
		}
237
	}
238