Code Duplication    Length = 8-11 lines in 3 locations

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

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

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

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

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

@@ 547-557 (lines=11) @@
544
			}
545
			$jdata = wp_remote_get( 'https://wetu.com/API/Itinerary/V8/Get?id=' . $wetu_id );		
546
547
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
548
				$jdata = json_decode( $jdata['body'], true );
549
				$return = $this->import_row( $jdata, $wetu_id, $post_id, $content );
550
				$this->format_completed_row( $return );
551
				$this->save_queue();
552
				$this->cleanup_posts();
553
				$this->attach_destination_images( $content );
554
				$this->clean_attached_destinations( $return );
555
			} else {
556
				$this->format_error( esc_html__( 'There was a problem importing your tour, please contact support.', 'wetu-importer' ) );
557
			}
558
		}
559
	}
560