Code Duplication    Length = 8-11 lines in 3 locations

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

@@ 484-492 (lines=9) @@
481
482
			$jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
483
484
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
485
				$adata = json_decode( $jdata['body'], true );
486
				$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
487
				$this->format_completed_row( $return );
488
				$this->remove_from_queue( $return );
489
				$this->cleanup_posts();
490
			} else {
491
				$this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'wetu-importer' ) );
492
			}
493
		}
494
	}
495

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

@@ 514-521 (lines=8) @@
511
512
			$jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
513
514
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
515
				$adata = json_decode( $jdata, true );
516
				$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
517
				$this->remove_from_queue( $return );
518
				$this->format_completed_row( $return );
519
			} else {
520
				$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.', 'wetu-importer' ) );
521
			}
522
		}
523
	}
524

classes/class-wetu-importer-tours.php 1 location

@@ 471-481 (lines=11) @@
468
			}
469
			$jdata = wp_remote_get( 'https://wetu.com/API/Itinerary/V8/Get?id=' . $wetu_id );		
470
471
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
472
				$jdata = json_decode( $jdata['body'], true );
473
				$return = $this->import_row( $jdata, $wetu_id, $post_id, $content );
474
				$this->format_completed_row( $return );
475
				$this->save_queue();
476
				$this->cleanup_posts();
477
				$this->attach_destination_images( $content );
478
				$this->clean_attached_destinations( $return );
479
			} else {
480
				$this->format_error( esc_html__( 'There was a problem importing your tour, please contact support.', 'wetu-importer' ) );
481
			}
482
		}
483
	}
484