Code Duplication    Length = 11-17 lines in 2 locations

includes/class-wc-stripe-webhook-state.php 2 locations

@@ 181-191 (lines=11) @@
178
		$date_format = 'Y-m-d H:i:s e';
179
180
		// Case 1 (Nominal case): Most recent = success
181
		if ( $last_success_at > $last_failure_at ) {
182
			$message = sprintf(
183
				$test_mode ?
184
					/* translators: 1) date and time of last webhook received, e.g. 2020-06-28 10:30:50 UTC */
185
					__( 'The most recent test webhook, timestamped %s, was processed successfully.', 'woocommerce-gateway-stripe' ) :
186
					/* translators: 1) date and time of last webhook received, e.g. 2020-06-28 10:30:50 UTC */
187
					__( 'The most recent live webhook, timestamped %s, was processed successfully.', 'woocommerce-gateway-stripe' ),
188
				date( $date_format, $last_success_at )
189
			);
190
			return $message;
191
		}
192
193
		// Case 2: No webhooks received yet
194
		if ( ( 0 == $last_success_at ) && ( 0 == $last_failure_at ) ) {
@@ 207-223 (lines=17) @@
204
		}
205
206
		// Case 3: Failure after success
207
		if ( $last_success_at > 0 ) {
208
			$message = sprintf(
209
				$test_mode ?
210
					/* translators: 1) date and time of last failed webhook e.g. 2020-06-28 10:30:50 UTC */
211
					/* translators: 2) reason webhook failed */
212
					/* translators: 3) date and time of last successful webhook e.g. 2020-05-28 10:30:50 UTC */
213
					__( 'Warning: The most recent test webhook, received at %s, could not be processed. Reason: %s. (The last test webhook to process successfully was timestamped %s.)', 'woocommerce-gateway-stripe' ) :
214
					/* translators: 1) date and time of last failed webhook e.g. 2020-06-28 10:30:50 UTC */
215
					/* translators: 2) reason webhook failed */
216
					/* translators: 3) date and time of last successful webhook e.g. 2020-05-28 10:30:50 UTC */
217
					__( 'Warning: The most recent live webhook, received at %s, could not be processed. Reason: %s. (The last live webhook to process successfully was timestamped %s.)', 'woocommerce-gateway-stripe' ),
218
				date( $date_format, $last_failure_at ),
219
				$last_error,
220
				date( $date_format, $last_success_at )
221
			);
222
			return $message;
223
		}
224
225
		// Case 4: Failure with no prior success
226
		$message = sprintf(