Passed
Push — master ( 05f68d...e2f2cb )
by Anthony
02:50
created

InitialiseClass   B

Complexity

Total Complexity 16

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 8
Dependencies 7

Importance

Changes 0
Metric Value
wmc 16
lcom 8
cbo 7
dl 0
loc 93
rs 7.6923
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getRessource() 0 7 2
A getBase() 0 7 2
A getBatiment() 0 7 2
A getUnite() 0 7 2
A getGoupeUnite() 0 7 2
A getCentreRecherche() 0 7 2
A getMissionsAleatoire() 0 7 2
A getDb() 0 8 2
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 $database;
15
		
16
		
17
		
18
		//-------------------------- GETTER ----------------------------------------------------------------------------//
19
		
20
		//initilisation of all classes of battle
21
		//initialisation of Ressource class
22
		public static function getRessource() {
23
			if (self::$ressource == null) {
24
				self::$ressource = new Ressource();
25
			}
26
			
27
			return self::$ressource;
28
		}
29
		
30
		//initialisation of Base class
31
		public static function getBase() {
32
			if (self::$base == null) {
33
				self::$base = new Base();
34
			}
35
			
36
			return self::$base;
37
		}
38
		
39
		//initialisation of Batiment class
40
		public static function getBatiment() {
41
			if (self::$batiment == null) {
42
				self::$batiment = new Batiment();
43
			}
44
			
45
			return self::$batiment;
46
		}
47
		
48
		//initialisation of Unite class
49
		public static function getUnite() {
50
			if (self::$unite == null) {
51
				self::$unite = new Unite();
52
			}
53
			
54
			return self::$unite;
55
		}
56
		
57
		//initialisation of GroupeUnite class
58
		public static function getGoupeUnite() {
59
			if (self::$groupe_unite == null) {
60
				self::$groupe_unite = new GroupeUnite();
61
			}
62
			
63
			return self::$groupe_unite;
64
		}
65
		
66
		//initialisation of CentreRecherche class
67
		public static function getCentreRecherche() {
68
			if (self::$centre_recherche == null) {
69
				self::$centre_recherche = new CentreRecherche();
70
			}
71
			
72
			return self::$centre_recherche;
73
		}
74
		
75
		//initialisation of MissionsAleatoire class
76
		public static function getMissionsAleatoire() {
77
			if (self::$missions_aleatoire == null) {
78
				self::$missions_aleatoire = new MissionsAleatoire();
79
			}
80
			
81
			return self::$missions_aleatoire;
82
		}
83
		
84
		//initialisation of Database Core connexion
85
		public static function getDb() {
86
			require_once("config.config.php");
87
			
88
			if (self::$database == null) {
89
				self::$database = new Database($type_co, $dbname, $dbuser, $dbpass, $dbhost);
0 ignored issues
show
Bug introduced by
The variable $type_co does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $dbname does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $dbuser does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $dbpass does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $dbhost does not exist. Did you forget to declare it?

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.

Loading history...
90
			}
91
			return self::$database;
92
		}
93
		//-------------------------- END GETTER ----------------------------------------------------------------------------//
94
		
95
		
96
		//-------------------------- SETTER ----------------------------------------------------------------------------//
97
		//-------------------------- END SETTER ----------------------------------------------------------------------------//    
98
	}