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

BackGroundFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
crap 2
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
}