UrlHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 40
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A draw() 0 22 3
1
<?php
2
3
namespace Kaloa\Renderer\Inigo\Handler;
4
5
use Kaloa\Renderer\Inigo\Handler\ProtoHandler;
6
use Kaloa\Renderer\Inigo\Parser;
7
8
/**
9
 *
10
 */
11
final class UrlHandler extends ProtoHandler
12
{
13
    /**
14
     *
15
     */
16 18
    public function __construct()
17
    {
18 18
        $this->name = 'url|link';
19 18
        $this->type = Parser::TAG_INLINE;
20 18
        $this->defaultParam = 'href';
21 18
    }
22
23
    /**
24
     *
25
     * @param  array  $data
26
     * @return string
27
     */
28 4
    public function draw(array $data)
29
    {
30 4
        $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...
31
32 4
        if ($data['front']) {
33 4
            $href = $this->fillParam($data, 'href', '');
34
35 4
            $title = $this->fillParam($data, 'title', null);
36
37 4
            if ($title !== null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38 1
                $title = ' title="' . $this->e($title) . '"';
39 1
            } else {
40 4
                $title = ' title="Open &quot;' . $this->e($href) . '&quot;"';
41
            }
42
43 4
            $ret = '<a href="' . $this->e($href) . '"' . $title . '>';
44 4
        } else {
45 4
            $ret = '</a>';
46
        }
47
48 4
        return $ret;
49
    }
50
}
51