Code Duplication    Length = 24-26 lines in 2 locations

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

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

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

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