Code Duplication    Length = 13-14 lines in 2 locations

mod/solr_api/start.php 2 locations

@@ 251-264 (lines=14) @@
248
	foreach ($entities as $entity) {
249
250
251
		if (is_Json($entity->title)) {
252
			$title_array = json_decode($entity->title, true);
253
			if (!isset($title_array['en']) || !isset($title_array['fr'])) {
254
				$title_array['en'] = str_replace('"', '\"', $title_array);
255
				$title_array['fr'] = str_replace('"', '\"', $title_array);
256
			} else {
257
				$title_array['en'] = str_replace('"', '\"', gc_explode_translation($entity->title, 'en'));
258
				$title_array['fr'] = str_replace('"', '\"', gc_explode_translation($entity->title, 'fr'));
259
			}
260
261
		} else {
262
			$title_array['en'] = $entity->title;
263
			$title_array['fr'] = $entity->title;
264
		}
265
266
		if (is_Json($entity->description)) {
267
			$description_array = json_decode($entity->description, true);
@@ 266-278 (lines=13) @@
263
			$title_array['fr'] = $entity->title;
264
		}
265
266
		if (is_Json($entity->description)) {
267
			$description_array = json_decode($entity->description, true);
268
			if (!isset($description_array['en']) || !isset($description_array['fr'])) {
269
				$description_array['en'] = str_replace('"', '\"', $description_array);
270
				$description_array['fr'] = str_replace('"', '\"', $description_array);
271
			} else {
272
				$description_array['en'] = str_replace('"', '\"', gc_explode_translation($entity->description, 'en'));
273
				$description_array['fr'] = str_replace('"', '\"', gc_explode_translation($entity->description, 'fr'));
274
			}
275
		} else {
276
			$description_array['en'] = $entity->description;
277
			$description_array['fr'] = $entity->description;
278
		}
279
280
		$arr[] = array(
281
			'guid' => $entity->getGUID(),