Code Duplication    Length = 14-19 lines in 6 locations

core/process/queries/QueryManagerMysqlMAD.php 2 locations

@@ 143-161 (lines=19) @@
140
        return $data;
141
    }
142
143
    public function getRecentMythic($mythic_pokemons)
144
    {
145
        $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified,
146
				CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."') AS disappear_time_real,
147
				latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
148
				FROM pokemon
149
				WHERE pokemon_id IN (".implode(',', $mythic_pokemons).')
150
				ORDER BY last_modified DESC
151
				LIMIT 0,12';
152
        $result = $this->mysqli->query($req);
153
        $data = array();
154
        if ($result->num_rows > 0) {
155
            while ($row = $result->fetch_object()) {
156
                $data[] = $row;
157
            }
158
        }
159
160
        return $data;
161
    }
162
163
    ///////////////////
164
    // Single Pokemon
@@ 557-570 (lines=14) @@
554
        return array('last_page' => $last_page, 'data' => $history);
555
    }
556
557
    private function getHistoryForGymPokemon($pkm_uids)
558
    {
559
        $req = "SELECT DISTINCT pokemon_uid, pokemon_id, cp, trainer_name
560
				FROM gympokemon
561
				WHERE pokemon_uid IN ('".implode("','", $pkm_uids)."')
562
				ORDER BY FIND_IN_SET(pokemon_uid, '".implode(',', $pkm_uids)."')";
563
        $result = $this->mysqli->query($req);
564
        $pokemons = array();
565
        while ($data = $result->fetch_object()) {
566
            $pokemons[$data->pokemon_uid] = $data;
567
        }
568
569
        return $pokemons;
570
    }
571
572
    ///////////
573
    // Raids

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 143-160 (lines=18) @@
140
        return $data;
141
    }
142
143
    public function getRecentMythic($mythic_pokemon)
144
    {
145
        $req = 'SELECT pokemon_id, encounter_id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
146
                lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina
147
                FROM sightings
148
                WHERE pokemon_id IN ('.implode(',', $mythic_pokemon).')
149
                ORDER BY updated DESC
150
                LIMIT 0,12';
151
        $result = $this->mysqli->query($req);
152
        $data = array();
153
        if ($result->num_rows > 0) {
154
            while ($row = $result->fetch_object()) {
155
                $data[] = $row;
156
            }
157
        }
158
159
        return $data;
160
    }
161
162
    ///////////////////
163
    // Single Pokemon

core/process/queries/QueryManagerMysqlRealDeviceMap.php 1 location

@@ 142-159 (lines=18) @@
139
        return $data;
140
    }
141
142
    public function getRecentMythic($mythic_pokemon)
143
    {
144
        $req = 'SELECT pokemon_id, id as encounter_id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
145
                lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina
146
                FROM pokemon
147
                WHERE pokemon_id IN ('.implode(',', $mythic_pokemon).')
148
                ORDER BY changed DESC
149
                LIMIT 0,12';
150
        $result = $this->mysqli->query($req);
151
        $data = array();
152
        if ($result->num_rows > 0) {
153
            while ($row = $result->fetch_object()) {
154
                $data[] = $row;
155
            }
156
        }
157
158
        return $data;
159
    }
160
161
    ///////////////////
162
    // Single Pokemon

core/process/queries/QueryManagerMysqlRocketmap.php 2 locations

@@ 143-161 (lines=19) @@
140
        return $data;
141
    }
142
143
    public function getRecentMythic($mythic_pokemons)
144
    {
145
        $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified,
146
				CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."') AS disappear_time_real,
147
				latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
148
				FROM pokemon
149
				WHERE pokemon_id IN (".implode(',', $mythic_pokemons).')
150
				ORDER BY last_modified DESC
151
				LIMIT 0,12';
152
        $result = $this->mysqli->query($req);
153
        $data = array();
154
        if ($result->num_rows > 0) {
155
            while ($row = $result->fetch_object()) {
156
                $data[] = $row;
157
            }
158
        }
159
160
        return $data;
161
    }
162
163
    ///////////////////
164
    // Single Pokemon
@@ 575-588 (lines=14) @@
572
        return array('last_page' => $last_page, 'data' => $history);
573
    }
574
575
    private function getHistoryForGymPokemon($pkm_uids)
576
    {
577
        $req = "SELECT DISTINCT pokemon_uid, pokemon_id, cp, trainer_name
578
				FROM gympokemon
579
				WHERE pokemon_uid IN ('".implode("','", $pkm_uids)."')
580
				ORDER BY FIND_IN_SET(pokemon_uid, '".implode(',', $pkm_uids)."')";
581
        $result = $this->mysqli->query($req);
582
        $pokemons = array();
583
        while ($data = $result->fetch_object()) {
584
            $pokemons[$data->pokemon_uid] = $data;
585
        }
586
587
        return $pokemons;
588
    }
589
590
    ///////////
591
    // Raids