Code Duplication    Length = 10-11 lines in 6 locations

require/class.ATC.php 1 location

@@ 41-50 (lines=10) @@
38
                }
39
        }
40
41
       public function deleteById($id) {
42
                $query = "DELETE FROM atc WHERE atc_id = :id";
43
                $query_values = array(':id' => $id);
44
                 try {
45
                        $sth = $this->db->prepare($query);
46
                        $sth->execute($query_values);
47
                } catch(PDOException $e) {
48
                        return "error : ".$e->getMessage();
49
                }
50
        }
51
52
       public function deleteAll() {
53
                $query = "DELETE FROM atc";

require/class.METAR.php 1 location

@@ 303-312 (lines=10) @@
300
                }
301
        }
302
303
       public function deleteMETAR($id) {
304
                $query = "DELETE FROM metar WHERE id = :id";
305
                $query_values = array(':id' => $id);
306
                 try {
307
                        $sth = $this->db->prepare($query);
308
                        $sth->execute($query_values);
309
                } catch(PDOException $e) {
310
                        return "error : ".$e->getMessage();
311
                }
312
        }
313
       public function deleteAllMETARLocation() {
314
                $query = "DELETE FROM metar";
315
                 try {

require/class.NOTAM.php 1 location

@@ 739-748 (lines=10) @@
736
		}
737
	}
738
739
	public function deleteNOTAM($id) {
740
		$query = "DELETE FROM notam WHERE id = :id";
741
		$query_values = array(':id' => $id);
742
		try {
743
			$sth = $this->db->prepare($query);
744
			$sth->execute($query_values);
745
		} catch(PDOException $e) {
746
			return "error : ".$e->getMessage();
747
		}
748
	}
749
	public function deleteAllNOTAMLocation() {
750
		$query = "DELETE FROM notam";
751
		try {

require/class.Source.php 1 location

@@ 59-68 (lines=10) @@
56
                }
57
        }
58
59
       public function deleteLocation($id) {
60
                $query = "DELETE FROM source_location WHERE id = :id";
61
                $query_values = array(':id' => $id);
62
                 try {
63
                        $sth = $this->db->prepare($query);
64
                        $sth->execute($query_values);
65
                } catch(PDOException $e) {
66
                        return "error : ".$e->getMessage();
67
                }
68
        }
69
       public function deleteAllLocation() {
70
                $query = "DELETE FROM source_location";
71
                 try {

require/class.Stats.php 2 locations

@@ 16-26 (lines=11) @@
13
		$this->db = $Connection->db;
14
        }
15
              
16
	public function addLastStatsUpdate($type,$stats_date) {
17
                $query = "DELETE FROM config WHERE name = :type;
18
            		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
19
                $query_values = array('type' => $type,':stats_date' => $stats_date);
20
                 try {
21
                        $sth = $this->db->prepare($query);
22
                        $sth->execute($query_values);
23
                } catch(PDOException $e) {
24
                        return "error : ".$e->getMessage();
25
                }
26
        }
27
28
	public function getLastStatsUpdate($type = 'last_update_stats') {
29
                $query = "SELECT value FROM config WHERE name = :type";
@@ 882-891 (lines=10) @@
879
                }
880
        }
881
882
	public function deleteStat($id) {
883
                $query = "DELETE FROM stats WHERE stats_id = :id";
884
                $query_values = array(':id' => $id);
885
                 try {
886
                        $sth = $this->db->prepare($query);
887
                        $sth->execute($query_values);
888
                } catch(PDOException $e) {
889
                        return "error : ".$e->getMessage();
890
                }
891
        }
892
	public function deleteStatFlight($type) {
893
                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
894
                $query_values = array(':type' => $type);