Completed
Pull Request — master (#51)
by De Cramer
02:45
created

BackGroundFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 14
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Gui\Factory;
4
5
use FML\Controls\Quads\Quad_BgsPlayerCard;
6
7
/**
8
 * Class LineBuilder
9
 *
10
 * @package eXpansion\Framework\Core\Model\Gui\Builders;
11
 * @author  oliver de Cramer <[email protected]>
12
 */
13
class BackGroundFactory
14
{
15
    public function create($width, $height, $index = 0)
16
    {
17
        $index = $index % 2;
0 ignored issues
show
Unused Code introduced by
$index 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...
18
19
        // TODO set proper default size & font.
20
        $background = new Quad_BgsPlayerCard(); //BgRacePlayerName
21
        $background->setSubStyle(Quad_BgsPlayerCard::SUBSTYLE_BgActivePlayerName)
22
            ->setSize($width, $height);
23
24
        return $background;
25
    }
26
}