Failed Conditions
Pull Request — master (#353)
by Florian
05:07
created

QueryManager::getTeamGuardians()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 1
c 0
b 0
f 0
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 7 and the first side effect is on line 3.

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
include_once __DIR__ . '/../../../config.php';
4
include_once __DIR__ . '/QueryManagerMysql.php';
5
include_once __DIR__ . '/QueryManagerPostgresql.php';
6
7
abstract class QueryManager {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
9
	protected static $time_offset;
10
	protected static $config;
11
12
	private static $current;
13
	public static function current() {
14
		global $time_offset;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
15
16
		if (self::$current == null) {
0 ignored issues
show
Coding Style introduced by
Blank line found at start of control structure
Loading history...
17
18
			$variables = realpath(dirname(__FILE__)) . '/../../json/variables.json';
19
			self::$config = json_decode(file_get_contents($variables));
20
21
			include_once(SYS_PATH.'/core/process/timezone.loader.php');
22
			self::$time_offset = $time_offset;
23
24
25
			switch (strtolower(SYS_DB_TYPE)) {
26
				case "monocle-alt":
27
				case "monocle-alt-mysql":
28
					self::$current = new QueryManagerMysqlMonocleAlternate();
29
					break;
30
				case "monocle-alt-pgsql":
31
					self::$current = new QueryManagerPostgresqlMonocleAlternate();
32
					break;
33
				default: //rocketmap
34
					self::$current = new QueryManagerMysqlRocketmap();
35
					break;
36
			}
37
		}
38
		return self::$current;
39
	}
40
	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...
41
42
	// Misc
43
	abstract public function getEcapedString($string);
44
45
	// Tester
46
	abstract public function testTotalPokemon();
47
	abstract public function testTotalGyms();
48
	abstract public function testTotalPokestops();
49
50
	// Homepage
51
	abstract public function getTotalPokemon();
52
	abstract public function getTotalLures();
53
	abstract public function getTotalGyms();
54
	abstract public function getTotalRaids();
55
	abstract public function getTotalGymsForTeam($team_id);
56
	abstract public function getRecentAll();
57
	abstract public function getRecentMythic($mythic_pokemon);
58
59
	// Single Pokemon
60
	abstract public function getGymsProtectedByPokemon($pokemon_id);
61
	abstract public function getPokemonLastSeen($pokemon_id);
62
	abstract public function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction);
63
	abstract public function getTop50Trainers($pokemon_id, $best_order_by, $best_direction);
64
	abstract public function getPokemonHeatmap($pokemon_id, $start, $end);
65
	abstract public function getPokemonGraph($pokemon_id);
66
	abstract public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons);
67
	abstract public function getPokemonSliderMinMax();
68
	abstract public function getMapsCoords();
69
	abstract public function getPokemonCount($pokemon_id);
70
	abstract public function getRaidCount($pokemon_id);
71
72
	// Pokestops
73
	abstract public function getTotalPokestops();
74
	abstract public function getAllPokestops();
75
76
	// Gyms
77
	abstract public function getTeamGuardians($team_id);
78
	abstract public function getOwnedAndPoints($team_id);
79
	abstract public function getAllGyms();
80
	abstract public function getGymData($gym_id);
81
	abstract public function getGymDefenders($gym_id);
82
83
	// Gym History
84
	abstract public function getGymHistories($gym_name, $team, $page, $ranking);
85
	abstract public function getGymHistoriesPokemon($gym_id);
86
	abstract public function getHistoryForGym($page, $gym_id);
87
88
	// Raids
89
	abstract public function getAllRaids($page);
90
91
	// Trainers
92
	abstract public function getTrainers($trainer_name, $team, $page, $ranking);
93
	abstract public function getTrainerLevelCount($team_id);
94
95
	// Cron
96
	abstract public function getPokemonCountsActive();
97
	abstract public function getPokemonCountsLastDay();
98
	abstract public function getCaptchaCount();
99
	abstract public function getNestData();
100
}