Code Duplication    Length = 23-25 lines in 2 locations

modules/bataille/app/controller/ForumFaction.php 1 location

@@ 96-120 (lines=25) @@
93
		/**
94
		 * fonction qui récupère les commentaires d'un forum en particulier
95
		 */
96
		private function getCommentaireForum() {
97
			$dbc = App::getDb();
98
			
99
			$query = $dbc->select()
100
				->from("_bataille_faction_forum_commentaire")
101
				->from("identite")
102
				->where("ID_faction_forum", "=", $this->id_forum, "AND")
103
				->where("_bataille_faction_forum_commentaire.ID_identite", "=", "identite.ID_identite", "", true)
104
				->get();
105
			
106
			if (count($query) > 0) {
107
				$commentaires = [];
108
				
109
				foreach ($query as $obj) {
110
					$commentaires[] = [
111
						"id_commentaire" => $obj->ID_faction_forum_commentaire,
112
						"commentaire" => $obj->commentaire,
113
						"date_creation" => $obj->date_creation,
114
						"pseudo" => $obj->pseudo
115
					];
116
				}
117
				
118
				Bataille::setValues(["forum_commentaires" => $commentaires]);
119
			}
120
		}
121
		//-------------------------- END GETTER ----------------------------------------------------------------------------//
122
		
123
		

modules/bataille/app/controller/RelationFaction.php 1 location

@@ 13-35 (lines=23) @@
10
		/**
11
		 * renvoi la liste des relations d'une faction
12
		 */
13
		public function getListeRelation() {
14
			$dbc = App::getDb();
15
			
16
			$query = $dbc->select()->from("_bataille_faction_relation")
17
				->from("_bataille_faction")
18
				->where("_bataille_faction_relation.ID_faction", "=", $this->id_faction, "AND")
19
				->where("_bataille_faction_relation.ID_autre_faction", "=", "_bataille_faction.ID_faction", "", true)
20
				->get();
21
			
22
			$relations = [];
23
			if (count($query) > 0) {
24
				foreach ($query as $obj) {
25
					$relations[] = [
26
						"id_relation" => $obj->ID_faction_relation,
27
						"relation" => $obj->relation,
28
						"id_autre_faction" => $obj->ID_autre_faction,
29
						"nom_autre_faction" => $obj->nom_faction
30
					];
31
				}
32
			}
33
			
34
			Bataille::setValues(["relations" => $relations]);
35
		}
36
		
37
		/**
38
		 * fonction qui récupère la liste des relations qu'il sera possible