Code Duplication    Length = 18-18 lines in 3 locations

admin/controller/AdminArticle.php 1 location

@@ 106-123 (lines=18) @@
103
					->get();
104
			}
105
			
106
			if ((is_array($query)) && (count($query) > 0)) {
107
				$articles = [];
108
				
109
				foreach ($query as $obj) {
110
					$articles[] = [
111
						"id_article" => $obj->ID_article,
112
						"title" => $obj->title,
113
						"url" => $obj->url,
114
						"image" => $this->getImageArticle($obj->url),
115
						"article" => $obj->article,
116
						"pseudo" => $obj->pseudo,
117
						"publication_date" => $this->getDateFr($obj->publication_date),
118
						"categories" => Blog::getCategory()->getCategoryArticle($obj->url)
119
					];
120
				}
121
				
122
				Blog::setValues(["articles" => $articles]);
123
			}
124
		}
125
		//-------------------------- END GETTER ----------------------------------------------------------------------------//
126
		

app/controller/Article.php 2 locations

@@ 65-82 (lines=18) @@
62
				->where("_blog_article.ID_identite", "=", "identite.ID_identite", "", true)
63
				->limit(0, $nb_article)->get();
64
			
65
			if ((is_array($query)) && (count($query) > 0)) {
66
				$articles = [];
67
				
68
				foreach ($query as $obj) {
69
					$articles[] = [
70
						"id_article" => $obj->ID_article,
71
						"title" => $obj->title,
72
						"url" => $obj->url,
73
						"image" => $this->getImageArticle($obj->url),
74
						"article" => $this->getExtract($obj->article),
75
						"pseudo" => $obj->pseudo,
76
						"publication_date" => $this->getDateFr($obj->publication_date),
77
						"categories" => Blog::getCategory()->getCategoryArticle($obj->url)
78
					];
79
				}
80
				
81
				Blog::setValues(["articles" => $articles]);
82
			}
83
		}
84
		
85
		/**
@@ 138-155 (lines=18) @@
135
				->where("_blog_article.ID_identite", "=", "identite.ID_identite", "", true)
136
				->get();
137
			
138
			if ((is_array($query)) && (count($query) > 0)) {
139
				$articles = [];
140
				
141
				foreach ($query as $obj) {
142
					$articles[] = [
143
						"id_article" => $obj->ID_article,
144
						"title" => $obj->title,
145
						"url" => $obj->url,
146
						"image" => $this->getImageArticle($obj->url),
147
						"article" => $this->getExtract($obj->article),
148
						"pseudo" => $obj->pseudo,
149
						"publication_date" => $this->getDateFr($obj->publication_date),
150
						"categories" => Blog::getCategory()->getCategoryArticle($obj->url)
151
					];
152
				}
153
				
154
				Blog::setValues(["articles" => $articles]);
155
			}
156
		}
157
		//-------------------------- END GETTER ----------------------------------------------------------------------------//
158