Failed Conditions
Push — master ( 328b73...9cdd6e )
by Markus
04:54
created

QueryManager   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 129
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 3

42 Methods

Rating   Name   Duplication   Size   Complexity  
A current() 0 27 5
A __construct() 0 3 1
getEcapedString() 0 1 ?
testTotalPokemon() 0 1 ?
testTotalGyms() 0 1 ?
testTotalPokestops() 0 1 ?
getTotalPokemon() 0 1 ?
getTotalLures() 0 1 ?
getTotalGyms() 0 1 ?
getTotalRaids() 0 1 ?
getTotalGymsForTeam() 0 1 ?
getRecentAll() 0 1 ?
getRecentMythic() 0 1 ?
getGymsProtectedByPokemon() 0 1 ?
getPokemonLastSeen() 0 1 ?
getTop50Pokemon() 0 1 ?
getTop50Trainers() 0 1 ?
getPokemonHeatmap() 0 1 ?
getPokemonGraph() 0 1 ?
getPokemonLive() 0 1 ?
getPokemonSliderMinMax() 0 1 ?
getMapsCoords() 0 1 ?
getPokemonCount() 0 1 ?
getRaidCount() 0 1 ?
getTotalPokestops() 0 1 ?
getAllPokestops() 0 1 ?
getTeamGuardians() 0 1 ?
getOwnedAndPoints() 0 1 ?
getAllGyms() 0 1 ?
getGymData() 0 1 ?
getGymDefenders() 0 1 ?
getGymHistories() 0 1 ?
getGymHistoriesPokemon() 0 1 ?
getHistoryForGym() 0 1 ?
getAllRaids() 0 1 ?
getTrainers() 0 1 ?
getTrainerLevelCount() 0 1 ?
getPokemonCountsActive() 0 1 ?
getPokemonCountsLastDay() 0 1 ?
getCaptchaCount() 0 1 ?
getNestData() 0 1 ?
getSpawnpointCount() 0 1 ?
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 9 and the first side effect is on line 5.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Worldopole;
4
5
include_once __DIR__.'/../../../config.php';
6
include_once __DIR__.'/QueryManagerMysql.php';
7
include_once __DIR__.'/QueryManagerPostgresql.php';
8
9
abstract class QueryManager
10
{
11
    protected static $time_offset;
12
    protected static $config;
13
14
    private static $current;
15
16
    public static function current()
17
    {
18
        global $time_offset;
19
20
        if (null == self::$current) {
21
            $variables = realpath(dirname(__FILE__)).'/../../json/variables.json';
22
            self::$config = json_decode(file_get_contents($variables));
23
24
            include_once SYS_PATH.'/core/process/timezone.loader.php';
25
            self::$time_offset = $time_offset;
26
27
            switch (strtolower(SYS_DB_TYPE)) {
28
                case 'monocle-alt':
29
                case 'monocle-alt-mysql':
30
                    self::$current = new QueryManagerMysqlMonocleAlternate();
31
                    break;
32
                case 'monocle-alt-pgsql':
33
                    self::$current = new QueryManagerPostgresqlMonocleAlternate();
34
                    break;
35
                default: //rocketmap
36
                    self::$current = new QueryManagerMysqlRocketmap();
37
                    break;
38
            }
39
        }
40
41
        return self::$current;
42
    }
43
44
    private function __construct()
0 ignored issues
show
introduced by
Something seems to be off here. Are you sure you want to declare the constructor as private, and the class as abstract?
Loading history...
45
    {
46
    }
47
48
    // Misc
49
    abstract public function getEcapedString($string);
50
51
    // Tester
52
    abstract public function testTotalPokemon();
53
54
    abstract public function testTotalGyms();
55
56
    abstract public function testTotalPokestops();
57
58
    // Homepage
59
    abstract public function getTotalPokemon();
60
61
    abstract public function getTotalLures();
62
63
    abstract public function getTotalGyms();
64
65
    abstract public function getTotalRaids();
66
67
    abstract public function getTotalGymsForTeam($team_id);
68
69
    abstract public function getRecentAll();
70
71
    abstract public function getRecentMythic($mythic_pokemon);
72
73
    // Single Pokemon
74
    abstract public function getGymsProtectedByPokemon($pokemon_id);
75
76
    abstract public function getPokemonLastSeen($pokemon_id);
77
78
    abstract public function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction);
79
80
    abstract public function getTop50Trainers($pokemon_id, $best_order_by, $best_direction);
81
82
    abstract public function getPokemonHeatmap($pokemon_id, $start, $end);
83
84
    abstract public function getPokemonGraph($pokemon_id);
85
86
    abstract public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons);
87
88
    abstract public function getPokemonSliderMinMax();
89
90
    abstract public function getMapsCoords();
91
92
    abstract public function getPokemonCount($pokemon_id);
93
94
    abstract public function getRaidCount($pokemon_id);
95
96
    // Pokestops
97
    abstract public function getTotalPokestops();
98
99
    abstract public function getAllPokestops();
100
101
    // Gyms
102
    abstract public function getTeamGuardians($team_id);
103
104
    abstract public function getOwnedAndPoints($team_id);
105
106
    abstract public function getAllGyms();
107
108
    abstract public function getGymData($gym_id);
109
110
    abstract public function getGymDefenders($gym_id);
111
112
    // Gym History
113
    abstract public function getGymHistories($gym_name, $team, $page, $ranking);
114
115
    abstract public function getGymHistoriesPokemon($gym_id);
116
117
    abstract public function getHistoryForGym($page, $gym_id);
118
119
    // Raids
120
    abstract public function getAllRaids($page);
121
122
    // Trainers
123
    abstract public function getTrainers($trainer_name, $team, $page, $ranking);
124
125
    abstract public function getTrainerLevelCount($team_id);
126
127
    // Cron
128
    abstract public function getPokemonCountsActive();
129
130
    abstract public function getPokemonCountsLastDay();
131
132
    abstract public function getCaptchaCount();
133
134
    abstract public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude);
135
136
    abstract public function getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude);
137
}
138