Code Duplication    Length = 15-17 lines in 3 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 247-261 (lines=15) @@
244
        return $points;
245
    }
246
247
    public function getPokemonGraph($pokemon_id)
248
    {
249
        $req = "SELECT COUNT(*) AS total, HOUR(disappear_time) AS disappear_hour
250
					FROM (SELECT FROM_UNIXTIME(expire_timestamp) as disappear_time FROM sightings WHERE pokemon_id = '".$pokemon_id."' LIMIT 100000) AS pokemonFiltered
251
				GROUP BY disappear_hour
252
				ORDER BY disappear_hour";
253
        $result = $this->mysqli->query($req);
254
        $array = array_fill(0, 24, 0);
255
        while ($result && $data = $result->fetch_object()) {
256
            $array[$data->disappear_hour] = $data->total;
257
        }
258
        // shift array because AM/PM starts at 1AM not 0:00
259
        $array[] = $array[0];
260
        array_shift($array);
261
262
        return $array;
263
    }
264

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 249-264 (lines=16) @@
246
        return $points;
247
    }
248
249
    public function getPokemonGraph($pokemon_id)
250
    {
251
        $req = "SELECT COUNT(*) AS total,
252
				HOUR(CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_hour
253
				FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 100000) AS pokemonFiltered
254
				GROUP BY disappear_hour
255
				ORDER BY disappear_hour";
256
        $result = $this->mysqli->query($req);
257
        $array = array_fill(0, 24, 0);
258
        while ($result && $data = $result->fetch_object()) {
259
            $array[$data->disappear_hour] = $data->total;
260
        }
261
        // shift array because AM/PM starts at 1AM not 0:00
262
        $array[] = $array[0];
263
        array_shift($array);
264
265
        return $array;
266
    }
267

core/process/queries/QueryManagerMysqlRealDeviceMap.php 1 location

@@ 221-237 (lines=17) @@
218
        return $points;
219
    }
220
221
    public function getPokemonGraph($pokemon_id)
222
    {
223
        $req = "SELECT COUNT(*) AS total, HOUR(disappear_time) AS disappear_hour
224
					FROM (SELECT FROM_UNIXTIME(expire_timestamp) as disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 100000) AS pokemonFiltered
225
				GROUP BY disappear_hour
226
				ORDER BY disappear_hour";
227
        $result = $this->mysqli->query($req);
228
        $array = array_fill(0, 24, 0);
229
        while ($result && $data = $result->fetch_object()) {
230
            $array[$data->disappear_hour] = $data->total;
231
        }
232
        // shift array because AM/PM starts at 1AM not 0:00
233
        $array[] = $array[0];
234
        array_shift($array);
235
236
        return $array;
237
    }
238
239
    public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons)
240
    {