Code Duplication    Length = 15-15 lines in 2 locations

lib/database.php 2 locations

@@ 302-316 (lines=15) @@
299
		$result = wp_delete_post( $post_id );
300
301
		// If deleting fails...
302
		if ( false === $result ) {
303
			$post = get_post( $post_id );
304
305
			// ...and the post both exists and isn't in the trash...
306
			if ( $post && 'trash' !== $post->post_status ) {
307
				// ... then something went wrong.
308
				return new WP_Error(
309
					'db_error',
310
					sprintf(
311
						__( 'Failed to delete post ID %d.', 'writing-on-github' ),
312
						$post_id
313
					)
314
				);
315
			}
316
		}
317
318
		return sprintf(
319
			__( 'Successfully deleted post ID %d.', 'writing-on-github' ),
@@ 328-342 (lines=15) @@
325
		$result = wp_delete_post( $post_id );
326
327
		// If deleting fails...
328
		if ( false === $result ) {
329
			$post = get_post( $post_id );
330
331
			// ...and the post both exists and isn't in the trash...
332
			if ( $post && 'trash' !== $post->post_status ) {
333
				// ... then something went wrong.
334
				return new WP_Error(
335
					'db_error',
336
					sprintf(
337
						__( 'Failed to delete post ID %d.', 'writing-on-github' ),
338
						$post_id
339
					)
340
				);
341
			}
342
		}
343
344
		return sprintf(
345
			__( 'Successfully deleted post ID %d.', 'writing-on-github' ),