Passed
Push — master ( 19aa21...369f5f )
by Anthony
02:52
created

Unite   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 29
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getInfosUnite() 0 12 3
1
<?php
2
	
3
	namespace modules\bataille\app\controller;
4
	
5
	
6
	class Unite {
7
		
8
		
9
		//-------------------------- BUILDER ----------------------------------------------------------------------------//
10
		public function __construct() {
11
			
12
		}
13
		//-------------------------- END BUILDER ----------------------------------------------------------------------------//
14
		
15
		
16
		//-------------------------- GETTER ----------------------------------------------------------------------------//
17
		public function getInfosUnite($unite, $niveau) {
0 ignored issues
show
Unused Code introduced by
The parameter $niveau is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
			$dbc1 = Bataille::getDb();
19
20
			$query = $dbc1->select()->from("unites")->where("nom", "=", $unite)->get();
21
22
			if ((is_array($query)) && (count($query) == 1)) {
0 ignored issues
show
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
23
24
			}
25
			else {
26
				return false;
27
			}
28
		}
29
		//-------------------------- END GETTER ----------------------------------------------------------------------------//
30
		
31
		
32
		//-------------------------- SETTER ----------------------------------------------------------------------------//
33
		//-------------------------- END SETTER ----------------------------------------------------------------------------//    
34
	}