Code Duplication    Length = 23-28 lines in 2 locations

require/class.Spotter.php 2 locations

@@ 2196-2223 (lines=28) @@
2193
	* @return Array list of aircraft types
2194
	*
2195
	*/
2196
	public function getAllAircraftTypes()
2197
	{
2198
		/*
2199
		$query  = "SELECT DISTINCT spotter_output.aircraft_icao AS aircraft_icao, spotter_output.aircraft_name AS aircraft_name
2200
								FROM spotter_output  
2201
								WHERE spotter_output.aircraft_icao <> '' 
2202
								ORDER BY spotter_output.aircraft_name ASC";
2203
								
2204
		*/
2205
		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft WHERE icao <> '' ORDER BY aircraft_name ASC";
2206
		
2207
		$sth = $this->db->prepare($query);
2208
		$sth->execute();
2209
2210
		$aircraft_array = array();
2211
		$temp_array = array();
2212
		
2213
		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2214
		{
2215
			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2216
			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2217
			$temp_array['aircraft_name'] = $row['aircraft_name'];
2218
2219
			$aircraft_array[] = $temp_array;
2220
		}
2221
2222
		return $aircraft_array;
2223
	}
2224
	
2225
	
2226
	/**
@@ 2802-2824 (lines=23) @@
2799
	* @return Array the route list
2800
	*
2801
	*/
2802
	public function getAllRoutes()
2803
	{
2804
		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
2805
				FROM spotter_output
2806
				WHERE spotter_output.ident <> '' 
2807
				GROUP BY route
2808
				ORDER BY route ASC";
2809
2810
		$sth = $this->db->prepare($query);
2811
		$sth->execute();
2812
2813
		$routes_array = array();
2814
		$temp_array = array();
2815
		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2816
		{
2817
			$temp_array['route'] = $row['route'];
2818
			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
2819
			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
2820
2821
			$routes_array[] = $temp_array;
2822
		}
2823
		return $routes_array;
2824
	}
2825
2826
	/**
2827
	* Update ident spotter data