Completed
Push — master ( ab54c8...77228d )
by Jean-Christophe
01:47
created

GitFileStatus   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIcon() 0 18 4
1
<?php
2
3
namespace Ubiquity\utils\git;
4
5
class GitFileStatus {
6
	public static $UNTRACKED="untracked";
7
	public static $MODIFIED="modified";
8
	public static $DELETED="deleted";
9
	public static $NONE="";
10
	public static function getIcon($status){
11
		$icon="";
0 ignored issues
show
Unused Code introduced by
$icon is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
12
		switch ($status){
13
			case self::$UNTRACKED:
14
				$icon="blue question";
15
				break;
16
			case self::$MODIFIED:
17
				$icon="green edit";
18
				break;
19
			case self::$DELETED:
20
				$icon="red remove";
21
				break;
22
			default:
23
				$icon="red question";
24
				break;
25
		}
26
		return $icon;
27
	}
28
}
29
30