Code Duplication    Length = 8-11 lines in 3 locations

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

@@ 465-473 (lines=9) @@
462
463
			$jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
464
465
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
466
				$adata = json_decode( $jdata['body'], true );
467
				$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
468
				$this->format_completed_row( $return );
469
				$this->remove_from_queue( $return );
470
				$this->cleanup_posts();
471
			} else {
472
				$this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'lsx-wetu-importer' ) );
473
			}
474
		}
475
	}
476

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

@@ 458-468 (lines=11) @@
455
			}
456
			$jdata = wp_remote_get( 'https://wetu.com/API/Itinerary/V8/Get?id=' . $wetu_id );
457
458
			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
459
				$jdata = json_decode( $jdata['body'], true );
460
				$return = $this->import_row( $jdata, $wetu_id, $post_id, $content );
461
				$this->format_completed_row( $return );
462
				$this->save_queue();
463
				$this->cleanup_posts();
464
				$this->attach_destination_images( $content );
465
				$this->clean_attached_destinations( $return );
466
			} else {
467
				$this->format_error( esc_html__( 'There was a problem importing your tour, please contact support.', 'lsx-wetu-importer' ) );
468
			}
469
		}
470
	}
471

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

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