Code Duplication    Length = 9-10 lines in 3 locations

modules/bataille/app/controller/CentreRecherche.php 3 locations

@@ 31-39 (lines=9) @@
28
29
			$query = $dbc->select()->from("_bataille_centre_recherche")->where("ID_base", "=", Bataille::getIdBase())->get();
30
31
			if ((is_array($query)) && (count($query) > 0)) {
32
				foreach ($query as $obj) {
33
					$recherche_base[] = [
34
						"recherche" => $obj->recherche,
35
						"niveau" => $obj->niveau,
36
						"type" => $obj->type
37
					];
38
				}
39
			}
40
41
			$query = $dbc1->select()->from("recherche")
42
				->where("niveau_centre", "<=", Bataille::getBatiment()->getNiveauBatiment("centre_recherche"))
@@ 45-53 (lines=9) @@
42
				->where("niveau_centre", "<=", Bataille::getBatiment()->getNiveauBatiment("centre_recherche"))
43
				->get();
44
45
			if ((is_array($query)) && (count($query) > 0)) {
46
				foreach ($query as $obj) {
47
					$all_recherche[] = [
48
						"recherche" => $obj->recherche,
49
						"type" => $obj->type,
50
						"cout" => unserialize($obj->cout)
51
					];
52
				}
53
			}
54
55
			$count = count($all_recherche);
56
@@ 100-109 (lines=10) @@
97
98
			$query = $dbc->select()->from("_bataille_centre_recherche")->where("type", "=", $type)->get();
99
100
			if ((is_array($query)) && (count($query) > 0)) {
101
				foreach ($query as $obj) {
102
					$recherche[] = [
103
						"niveau" => $obj->niveau,
104
						"recherche" => $obj->recherche
105
					];
106
				}
107
108
				return $recherche;
109
			}
110
111
			return 0;
112
		}