Code Duplication    Length = 3-4 lines in 10 locations

require/class.SpotterImport.php 10 locations

@@ 295-297 (lines=3) @@
292
		    }
293
		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
294
295
		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
296
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
297
		}
298
		if (isset($line['waypoints']) && $line['waypoints'] != '') {
299
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
300
		}
@@ 298-300 (lines=3) @@
295
		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
296
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
297
		}
298
		if (isset($line['waypoints']) && $line['waypoints'] != '') {
299
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
300
		}
301
		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
302
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
303
		}
@@ 301-303 (lines=3) @@
298
		if (isset($line['waypoints']) && $line['waypoints'] != '') {
299
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
300
		}
301
		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
302
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
303
		}
304
		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
305
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
306
		}
@@ 304-306 (lines=3) @@
301
		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
302
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
303
		}
304
		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
305
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
306
		}
307
 
308
		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
309
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
@@ 330-332 (lines=3) @@
327
		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
328
329
		    //$putinarchive = true;
330
		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
331
			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
332
		    }
333
		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
334
			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
335
		    }
@@ 333-335 (lines=3) @@
330
		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
331
			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
332
		    }
333
		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
334
			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
335
		    }
336
		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
337
		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
338
		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
@@ 488-491 (lines=4) @@
485
			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
486
		    }
487
		}
488
		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
489
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
490
		    //$dataFound = true;
491
		}
492
		if (isset($line['format_source']) && $line['format_source'] != '') {
493
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
494
		}
@@ 492-494 (lines=3) @@
489
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
490
		    //$dataFound = true;
491
		}
492
		if (isset($line['format_source']) && $line['format_source'] != '') {
493
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
494
		}
495
		if (isset($line['source_name']) && $line['source_name'] != '') {
496
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
497
		}
@@ 495-497 (lines=3) @@
492
		if (isset($line['format_source']) && $line['format_source'] != '') {
493
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
494
		}
495
		if (isset($line['source_name']) && $line['source_name'] != '') {
496
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
497
		}
498
		if (isset($line['emergency']) && $line['emergency'] != '') {
499
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
500
		    //$dataFound = true;
@@ 498-501 (lines=4) @@
495
		if (isset($line['source_name']) && $line['source_name'] != '') {
496
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
497
		}
498
		if (isset($line['emergency']) && $line['emergency'] != '') {
499
		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
500
		    //$dataFound = true;
501
		}
502
		if (isset($line['ground']) && $line['ground'] != '') {
503
		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
504
			// Here we force archive of flight because after ground it's a new one (or should be)