Code Duplication    Length = 33-35 lines in 2 locations

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 227-259 (lines=33) @@
224
		return $array;
225
	}
226
227
	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
228
		$inmap_pkms_filter = "";
229
		$where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon_id = ".$pokemon_id;
230
231
		$reqTestIv = "SELECT MAX(individual_attack) AS iv FROM pokemon ".$where;
232
		$resultTestIv = $this->mysqli->query($reqTestIv);
233
		$testIv = $resultTestIv->fetch_object();
234
		if (!is_null($inmap_pokemons) && ($inmap_pokemons != "")) {
235
			foreach ($inmap_pokemons as $inmap) {
236
				$inmap_pkms_filter .= "'".$inmap."',";
237
			}
238
			$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
239
			$where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") ";
240
		}
241
		if ($testIv->iv != null && !is_null($ivMin) && ($ivMin != "")) {
242
			$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") ";
243
		}
244
		if ($testIv->iv != null && !is_null($ivMax) && ($ivMax != "")) {
245
			$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <= (".$ivMax.") ";
246
		}
247
		$req = "SELECT pokemon_id, encounter_id, latitude, longitude, disappear_time,
248
						(CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real,
249
						individual_attack, individual_defense, individual_stamina, move_1, move_2
250
						FROM pokemon ".$where."
251
						ORDER BY disappear_time DESC
252
						LIMIT 5000";
253
		$result = $this->mysqli->query($req);
254
		$spawns = array();
255
		while ($data = $result->fetch_object()) {
256
			$spawns[] = $data;
257
		}
258
		return $spawns;
259
	}
260
261
	public function getPokemonSliderMinMax() {
262
		$req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 231-265 (lines=35) @@
228
		return $array;
229
	}
230
231
	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
232
		$inmap_pkms_filter = "";
233
		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = " . $pokemon_id;
234
235
		$reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings " . $where;
236
		$resultTestIv = $this->mysqli->query($reqTestIv);
237
		$testIv = $resultTestIv->fetch_object();
238
		if (!is_null($inmap_pokemons) && ($inmap_pokemons != "")) {
239
			foreach ($inmap_pokemons as $inmap) {
240
				$inmap_pkms_filter .= "'".$inmap."',";
241
			}
242
			$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
243
			$where .= " AND encounter_id NOT IN (" . $inmap_pkms_filter . ") ";
244
		}
245
		if ($testIv->iv != null && !is_null($ivMin) && ($ivMin != "")) {
246
			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (" . $ivMin . ") ";
247
		}
248
		if ($testIv->iv != null && !is_null($ivMax) && ($ivMax != "")) {
249
			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (" . $ivMax . ") ";
250
		}
251
		$req = "SELECT pokemon_id, lat AS latitude, lon AS longitude,
252
    					FROM_UNIXTIME(expire_timestamp) AS disappear_time,
253
    					FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
254
    					atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina,
255
   						move_1, move_2
256
					FROM sightings " . $where . "
257
					ORDER BY disappear_time DESC
258
					LIMIT 5000";
259
		$result = $this->mysqli->query($req);
260
		$spawns = array();
261
		while ($data = $result->fetch_object()) {
262
			$spawns[] = $data;
263
		}
264
		return $spawns;
265
	}
266
267
	public function getPokemonSliderMinMax() {
268
		$req = "SELECT FROM_UNIXTIME(MIN(expire_timestamp)) AS min, FROM_UNIXTIME(MAX(expire_timestamp)) AS max FROM sightings";