1
|
|
|
<?php |
2
|
|
|
namespace modules\bataille\app\controller; |
3
|
|
|
|
4
|
|
|
use core\database\Database; |
5
|
|
|
|
6
|
|
|
class InitialiseClass { |
7
|
|
|
protected static $ressource; |
8
|
|
|
protected static $base; |
9
|
|
|
protected static $batiment; |
10
|
|
|
protected static $unite; |
11
|
|
|
protected static $groupe_unite; |
12
|
|
|
protected static $centre_recherche; |
13
|
|
|
protected static $missions_aleatoire; |
14
|
|
|
protected static $relation_faction; |
15
|
|
|
protected static $database; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
|
19
|
|
|
//-------------------------- GETTER ----------------------------------------------------------------------------// |
20
|
|
|
|
21
|
|
|
//initilisation of all classes of battle |
22
|
|
|
//initialisation of Ressource class |
23
|
|
|
public static function getRessource() { |
24
|
|
|
/*if (self::$ressource == null) {*/ |
|
|
|
|
25
|
|
|
self::$ressource = new Ressource(); |
26
|
|
|
/*}*/ |
27
|
|
|
|
28
|
|
|
return self::$ressource; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
//initialisation of Base class |
32
|
|
|
public static function getBase() { |
33
|
|
|
if (self::$base == null) { |
34
|
|
|
self::$base = new Base(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
return self::$base; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
//initialisation of Batiment class |
41
|
|
|
public static function getBatiment() { |
42
|
|
|
if (self::$batiment == null) { |
43
|
|
|
self::$batiment = new Batiment(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
return self::$batiment; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
//initialisation of Unite class |
50
|
|
|
public static function getUnite() { |
51
|
|
|
if (self::$unite == null) { |
52
|
|
|
self::$unite = new Unite(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
return self::$unite; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
//initialisation of GroupeUnite class |
59
|
|
|
public static function getGoupeUnite() { |
60
|
|
|
if (self::$groupe_unite == null) { |
61
|
|
|
self::$groupe_unite = new GroupeUnite(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return self::$groupe_unite; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
//initialisation of CentreRecherche class |
68
|
|
|
public static function getCentreRecherche() { |
69
|
|
|
if (self::$centre_recherche == null) { |
70
|
|
|
self::$centre_recherche = new CentreRecherche(); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
return self::$centre_recherche; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
//initialisation of MissionsAleatoire class |
77
|
|
|
public static function getMissionsAleatoire() { |
78
|
|
|
if (self::$missions_aleatoire == null) { |
79
|
|
|
self::$missions_aleatoire = new MissionsAleatoire(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
return self::$missions_aleatoire; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
//initialisation of Faction class |
86
|
|
|
public static function getRelationFaction() { |
87
|
|
|
if (self::$relation_faction == null) { |
88
|
|
|
self::$relation_faction = new RelationFaction(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
return self::$relation_faction; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
//initialisation of Database Core connexion |
95
|
|
|
public static function getDb() { |
96
|
|
|
require_once("config.config.php"); |
97
|
|
|
|
98
|
|
|
if (self::$database == null) { |
99
|
|
|
self::$database = new Database($type_co, $dbname, $dbuser, $dbpass, $dbhost); |
|
|
|
|
100
|
|
|
} |
101
|
|
|
return self::$database; |
102
|
|
|
} |
103
|
|
|
//-------------------------- END GETTER ----------------------------------------------------------------------------// |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
//-------------------------- SETTER ----------------------------------------------------------------------------// |
107
|
|
|
//-------------------------- END SETTER ----------------------------------------------------------------------------// |
108
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.