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

Unite::getInfosUnite()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 12
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 6
nc 2
nop 2
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
	}