Code Duplication    Length = 15-17 lines in 3 locations

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

@@ 469-484 (lines=16) @@
466
467
			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
468
469
			if ( $jdata ) {
470
				$adata = json_decode( $jdata,true );
471
				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
472
					$return = $this->import_row( $adata,$wetu_id,$post_id,$team_members,$content,$safari_brands );
473
					$this->format_completed_row( $return );
474
					$this->remove_from_queue( $return );
475
					$this->cleanup_posts();
476
				} else {
477
					if ( isset( $adata['error'] ) ) {
478
						$this->format_error( $adata['error'] );
479
					} else {
480
						$this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'wetu-importer' ) );
481
					}
482
				}
483
			}
484
		}
485
	}
486
487
	/**

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

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

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

@@ 538-554 (lines=17) @@
535
536
			$jdata = file_get_contents( 'http://wetu.com/API/Itinerary/V7/Get?id=' . $wetu_id );
537
538
			if ( $jdata ) {
539
				$jdata = json_decode( $jdata,true );
540
				if ( ! empty( $jdata ) && ! isset( $jdata['error'] ) ) {
541
					$return = $this->import_row( $jdata,$wetu_id,$post_id,$content );
542
					$this->format_completed_row( $return );
543
					$this->save_queue();
544
					$this->cleanup_posts();
545
					$this->attach_destination_images( $content );
546
					$this->clean_attached_destinations( $return );
547
				} else {
548
					if ( isset( $adata['error'] ) ) {
549
						$this->format_error( $adata['error'] );
550
					} else {
551
						$this->format_error( esc_html__( 'There was a problem importing your tour, please try refreshing the page.','wetu-importer' ) );
552
					}
553
				}
554
			}
555
		}
556
	}
557