Code Duplication    Length = 15-15 lines in 2 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 560-574 (lines=15) @@
557
        $result = $this->mysqli->query($req);
558
        $history = array();
559
        $count = 0;
560
        while ($data = $result->fetch_object()) {
561
            ++$count;
562
            if (0 == $data->total_cp) {
563
                $data->pokemon = array();
564
                $data->pokemon_count = 0;
565
                $data->pokemon_uids = '';
566
            } else {
567
                $data->pokemon = $this->getHistoryForGymPokemon($gym_id, $data->last_modified_real);
568
                $data->pokemon_count = count($data->pokemon);
569
                $data->pokemon_uids = implode(',', array_keys($data->pokemon));
570
            }
571
            if (0 === $data->total_cp || 0 !== $data->pokemon_count) {
572
                $history[] = $data;
573
            }
574
        }
575
        if ($count !== ($pageSize + 1)) {
576
            $last_page = true;
577
        } else {

core/process/queries/QueryManagerPostgresqlMonocleAlternate.php 1 location

@@ 539-553 (lines=15) @@
536
        $result = pg_query($this->db, $req);
537
        $history = array();
538
        $count = 0;
539
        while ($data = pg_fetch_object($result)) {
540
            ++$count;
541
            if (0 == $data->total_cp) {
542
                $data->pokemon = array();
543
                $data->pokemon_count = 0;
544
                $data->pokemon_uids = '';
545
            } else {
546
                $data->pokemon = $this->getHistoryForGymPokemon($gym_id, $data->last_modified_real);
547
                $data->pokemon_count = count($data->pokemon);
548
                $data->pokemon_uids = implode(',', array_keys($data->pokemon));
549
            }
550
            if (0 === $data->total_cp || 0 !== $data->pokemon_count) {
551
                $history[] = $data;
552
            }
553
        }
554
        if ($count !== ($pageSize + 1)) {
555
            $last_page = true;
556
        } else {