Code Duplication    Length = 13-16 lines in 3 locations

require/class.Spotter.php 3 locations

@@ 2012-2025 (lines=14) @@
2009
	* @return String aircraft type
2010
	*
2011
	*/
2012
	public function getAllAircraftType($aircraft_modes)
2013
	{
2014
		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2015
2016
		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2017
		
2018
		$sth = $this->db->prepare($query);
2019
		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
2020
2021
		$row = $sth->fetch(PDO::FETCH_ASSOC);
2022
		if (isset($row['icaotypecode'])) {
2023
			return $row['icaotypecode'];
2024
		} else return '';
2025
	}
2026
2027
	/**
2028
	* Gets correct aircraft operator corde
@@ 2034-2046 (lines=13) @@
2031
	* @return String aircraft operator code
2032
	*
2033
	*/
2034
	public function getOperator($operator)
2035
	{
2036
		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2037
		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2038
		
2039
		$sth = $this->db->prepare($query);
2040
		$sth->execute(array(':operator' => $operator));
2041
2042
		$row = $sth->fetch(PDO::FETCH_ASSOC);
2043
		if (isset($row['operator_correct'])) {
2044
			return $row['operator_correct'];
2045
		} else return $operator;
2046
	}
2047
2048
	/**
2049
	* Gets the aircraft route based on the aircraft callsign
@@ 8467-8482 (lines=16) @@
8464
	*
8465
	*/
8466
	
8467
	public function getAircraftRegistrationBymodeS($aircraft_modes)
8468
	{
8469
		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
8470
	
8471
		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
8472
		
8473
		$sth = $this->db->prepare($query);
8474
		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
8475
    
8476
		$row = $sth->fetch(PDO::FETCH_ASSOC);
8477
		if (count($row) > 0) {
8478
		    //return $row['Registration'];
8479
		    return $row['registration'];
8480
		} else return '';
8481
	
8482
	}
8483
8484
	/**
8485
	* Gets the aircraft type from ModeS