SimpleHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 48
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A draw() 0 12 2
1
<?php
2
3
namespace Kaloa\Renderer\Inigo\Handler;
4
5
use Kaloa\Renderer\Inigo\Handler\ProtoHandler;
6
7
/**
8
 *
9
 */
10
final class SimpleHandler extends ProtoHandler
11
{
12
    /**
13
     *
14
     * @var string
15
     */
16
    private $front;
17
18
    /**
19
     *
20
     * @var string
21
     */
22
    private $back;
23
24
    /**
25
     *
26
     * @param string $name
27
     * @param int $type
28
     * @param string $front
29
     * @param string $back
30
     */
31 18
    public function __construct($name, $type, $front, $back)
32
    {
33 18
        $this->name  = $name;
34 18
        $this->type  = $type;
35 18
        $this->front = $front;
36 18
        $this->back  = $back;
37 18
    }
38
39
    /**
40
     *
41
     * @param array $data
42
     *
43
     * @return string
44
     */
45 5
    public function draw(array $data)
46
    {
47 5
        $ret = '';
0 ignored issues
show
Unused Code introduced by
$ret 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...
48
49 5
        if ($data['front']) {
50 5
            $ret = $this->front;
51 5
        } else {
52 5
            $ret = $this->back;
53
        }
54
55 5
        return $ret;
56
    }
57
}
58