Code Duplication    Length = 12-13 lines in 2 locations

require/class.SpotterLive.php 2 locations

@@ 356-368 (lines=13) @@
353
	* @return Array the spotter information
354
	*
355
	*/
356
	public function getDateLiveSpotterDataByIdent($ident,$date)
357
	{
358
		$Spotter = new Spotter($this->db);
359
		date_default_timezone_set('UTC');
360
361
		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
362
                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
363
364
                $date = date('c',$date);
365
		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
366
367
		return $spotter_array;
368
	}
369
370
        /**
371
	* Gets last spotter information based on a particular callsign
@@ 395-406 (lines=12) @@
392
	* @return Array the spotter information
393
	*
394
	*/
395
	public function getDateLiveSpotterDataById($id,$date)
396
	{
397
		$Spotter = new Spotter($this->db);
398
		date_default_timezone_set('UTC');
399
400
		$id = filter_var($id, FILTER_SANITIZE_STRING);
401
                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
402
                $date = date('c',$date);
403
		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
404
405
		return $spotter_array;
406
	}
407
408
        /**
409
	* Gets altitude information based on a particular callsign