Code Duplication    Length = 24-26 lines in 2 locations

classes/class-lsx-wetu-importer-accommodation.php 1 location

@@ 309-332 (lines=24) @@
306
				}
307
308
				// Run through each accommodation and use it.
309
				if ( ! empty( $accommodation ) ) {
310
					foreach ( $accommodation as $row_key => $row ) {
311
						if ( 'import' === $post_status ) {
312
							if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
313
								$current_status = get_post_status( $row['post_id'] );
314
								if ( 'draft' === $current_status ) {
315
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
316
								}
317
							} else {
318
								continue;
319
							}
320
						} else {
321
							if ( 0 === $row['post_id'] ) {
322
								continue;
323
							} else {
324
								$current_status = get_post_status( $row['post_id'] );
325
								if ( $current_status !== $post_status ) {
326
									continue;
327
								}
328
							}
329
							$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
330
						}
331
					}
332
				}
333
			} else {
334
				$key_string_search = implode( '+', $keyphrases );
335
				$search_data       = wp_remote_get( $this->url . '/Search/' . $key_string_search );

classes/class-lsx-wetu-importer-destination.php 1 location

@@ 367-392 (lines=26) @@
364
				}
365
366
				// Run through each accommodation and use it.
367
				if ( ! empty( $accommodation ) ) {
368
					foreach ( $accommodation as $row_key => $row ) {
369
						if ( 'import' === $post_status ) {
370
371
							if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
372
								$current_status = get_post_status( $row['post_id'] );
373
								if ( 'draft' === $current_status ) {
374
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
375
								}
376
							} else {
377
								continue;
378
							}
379
						} else {
380
							if ( 0 === $row['post_id'] ) {
381
								continue;
382
							} else {
383
								$current_status = get_post_status( $row['post_id'] );
384
385
								if ( $current_status !== $post_status ) {
386
									continue;
387
								}
388
							}
389
							$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
390
						}
391
					}
392
				}
393
			} else {
394
395
				$key_string_search = implode( '+', $keyphrases );