Complex classes like Bataille often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Bataille, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 6 | 	class Bataille { | 
            ||
| 7 | private static $ressource;  | 
            ||
| 8 | private static $base;  | 
            ||
| 9 | private static $batiment;  | 
            ||
| 10 | private static $points;  | 
            ||
| 11 | private static $unite;  | 
            ||
| 12 | private static $centre_recherche;  | 
            ||
| 13 | private static $missions_aleatoire;  | 
            ||
| 14 | private static $map;  | 
            ||
| 15 | private static $database;  | 
            ||
| 16 | private static $nation;  | 
            ||
| 17 | |||
| 18 | private static $id_base;  | 
            ||
| 19 | |||
| 20 | public static $values = [];  | 
            ||
| 21 | |||
| 22 | |||
| 23 | //-------------------------- BUILDER ----------------------------------------------------------------------------//  | 
            ||
| 24 | 		public function __construct() { | 
            ||
| 27 | //-------------------------- END BUILDER ----------------------------------------------------------------------------//  | 
            ||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | //-------------------------- GETTER ----------------------------------------------------------------------------//  | 
            ||
| 32 | /**  | 
            ||
| 33 | * @return array  | 
            ||
| 34 | * get array of all values wich will be used in the page  | 
            ||
| 35 | */  | 
            ||
| 36 | 		public static function getValues() { | 
            ||
| 39 | |||
| 40 | //initilisation of all classes of battle  | 
            ||
| 41 | //initialisation of Ressource class  | 
            ||
| 42 | 		public static function getRessource() { | 
            ||
| 49 | |||
| 50 | //initialisation of Base class  | 
            ||
| 51 | 		public static function getBase() { | 
            ||
| 58 | |||
| 59 | //initialisation of Batiment class  | 
            ||
| 60 | 		public static function getBatiment() { | 
            ||
| 67 | |||
| 68 | //initialisation of Points class  | 
            ||
| 69 | 		public static function getPoints() { | 
            ||
| 76 | |||
| 77 | //initialisation of Map class  | 
            ||
| 78 | 		public static function getMap() { | 
            ||
| 85 | |||
| 86 | //initialisation of Batiment class  | 
            ||
| 87 | 		public static function getUnite() { | 
            ||
| 94 | |||
| 95 | //initialisation of CentreRecherche class  | 
            ||
| 96 | 		public static function getCentreRecherche() { | 
            ||
| 103 | |||
| 104 | //initialisation of MissionsAleatoire class  | 
            ||
| 105 | 		public static function getMissionsAleatoire() { | 
            ||
| 112 | |||
| 113 | //initialisation of Database Core connexion  | 
            ||
| 114 | 		public static function getDb() { | 
            ||
| 122 | |||
| 123 | /**  | 
            ||
| 124 | * @return mixe  | 
            ||
| 125 | * récupère l'ID_identité du joueur  | 
            ||
| 126 | */  | 
            ||
| 127 | 		public static function getIdIdentite() { | 
            ||
| 130 | |||
| 131 | /**  | 
            ||
| 132 | * @return mixed  | 
            ||
| 133 | * renvoi l'id_base du joueur  | 
            ||
| 134 | */  | 
            ||
| 135 | 		public static function getIdBase() { | 
            ||
| 144 | |||
| 145 | /**  | 
            ||
| 146 | * @return mixed  | 
            ||
| 147 | * renvoi le premier ID_base du joueur (première base et base princ du joueur)  | 
            ||
| 148 | */  | 
            ||
| 149 | 		public static function getFirstBase() { | 
            ||
| 162 | |||
| 163 | /**  | 
            ||
| 164 | * @param $id_base  | 
            ||
| 165 | * @return array  | 
            ||
| 166 | * fonction qui renvoi les posisitons en x et y d'une base  | 
            ||
| 167 | */  | 
            ||
| 168 | 		private static function getPosistionBase($id_base) { | 
            ||
| 187 | |||
| 188 | /**  | 
            ||
| 189 | * @return int  | 
            ||
| 190 | * return now timestamp  | 
            ||
| 191 | */  | 
            ||
| 192 | 		public static function getToday() { | 
            ||
| 196 | |||
| 197 | /**  | 
            ||
| 198 | * @param null $id_base -> sert si definit a recuperer l'id identite de la abse en question  | 
            ||
| 199 | * @return string|null  | 
            ||
| 200 | * recupere la date de la derniere connexion  | 
            ||
| 201 | */  | 
            ||
| 202 | 		public static function getLastConnexion($id_base = null) { | 
            ||
| 224 | |||
| 225 | /**  | 
            ||
| 226 | * @param string $nom_ressource  | 
            ||
| 227 | * @param $ressource  | 
            ||
| 228 | * @return array  | 
            ||
| 229 | * fonction qui permet de renvyer la couleur rouge si pas assez de ressource pour construire le batiment  | 
            ||
| 230 | * ou pour creer une unité...  | 
            ||
| 231 | */  | 
            ||
| 232 | 		public static function getTestAssezRessourceBase($nom_ressource, $ressource) { | 
            ||
| 247 | |||
| 248 | /**  | 
            ||
| 249 | * @param $id_base  | 
            ||
| 250 | * @param integer $vitesse = vitesse de l'unité en question  | 
            ||
| 251 | * @return number  | 
            ||
| 252 | * fonction qui renvoi le temps de trajet entre la base du joueur et une autre base en secondes  | 
            ||
| 253 | */  | 
            ||
| 254 | 		public static function getDureeTrajet($id_base, $vitesse = 1) { | 
            ||
| 268 | |||
| 269 | /**  | 
            ||
| 270 | * @param null $id_identite  | 
            ||
| 271 | * get nation of a player  | 
            ||
| 272 | */  | 
            ||
| 273 | 		public static function getNation($id_identite = null) { | 
            ||
| 293 | |||
| 294 | /**  | 
            ||
| 295 | * @param $posx  | 
            ||
| 296 | * @param $posy  | 
            ||
| 297 | * @return int  | 
            ||
| 298 | * fonction qui renvoi un ID_base en fonction de sa posx et posy et 0 si base inexistante  | 
            ||
| 299 | */  | 
            ||
| 300 | 		public static function getBaseExistPosition($posx, $posy) { | 
            ||
| 314 | |||
| 315 | /**  | 
            ||
| 316 | * @return integer  | 
            ||
| 317 | * fonction qui permet de récupérer le nombre de joueurs sur le serveur  | 
            ||
| 318 | */  | 
            ||
| 319 | 		public static function getNombreJoueur() { | 
            ||
| 330 | |||
| 331 | /**  | 
            ||
| 332 | * @param string $param  | 
            ||
| 333 | * @return mixed  | 
            ||
| 334 | * fonction qui sert à récupérer un parametre spécifique pour un batiment  | 
            ||
| 335 | * par exemple la vitesse d'un marchand ou le nombred'emplacment de la base  | 
            ||
| 336 | */  | 
            ||
| 337 | 		public static function getParam($param) { | 
            ||
| 346 | //-------------------------- END GETTER ----------------------------------------------------------------------------//  | 
            ||
| 347 | |||
| 348 | |||
| 349 | |||
| 350 | //-------------------------- SETTER ----------------------------------------------------------------------------//  | 
            ||
| 351 | /**  | 
            ||
| 352 | * set la date de derniere connexion a now  | 
            ||
| 353 | */  | 
            ||
| 354 | 		public static function setLastConnexion($id_base = null) { | 
            ||
| 370 | |||
| 371 | /**  | 
            ||
| 372 | * @param $values  | 
            ||
| 373 | * can set values while keep older infos  | 
            ||
| 374 | */  | 
            ||
| 375 | 		public static function setValues($values) { | 
            ||
| 378 | //-------------------------- END SETTER ----------------------------------------------------------------------------//  | 
            ||
| 379 | }  | 
            
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.