Code Duplication    Length = 15-17 lines in 3 locations

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

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

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

@@ 528-542 (lines=15) @@
525
526
			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
527
528
			if ( $jdata ) {
529
				$adata = json_decode( $jdata, true );
530
531
				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
532
					$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
533
					$this->remove_from_queue( $return );
534
					$this->format_completed_row( $return );
535
				} else {
536
					if ( isset( $adata['error'] ) ) {
537
						$this->format_error( $adata['error'] );
538
					} else {
539
						$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.','wetu-importer' ) );
540
					}
541
				}
542
			}
543
		}
544
	}
545

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

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