YouTubeHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 35
ccs 14
cts 14
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 17 2
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 YouTubeHandler extends ProtoHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
12
{
13
    /**
14
     *
15
     */
16 18
    public function __construct()
17
    {
18 18
        $this->name = 'youtube';
19 18
        $this->type = Parser::TAG_OUTLINE;
20 18
        $this->defaultParam = 'id';
21 18
    }
22
23
    /**
24
     *
25
     * @param  array  $data
26
     * @return string
27
     */
28 1
    public function draw(array $data)
29
    {
30 1
        $ret = '';
31
32 1
        if ($data['front']) {
33 1
            $vid = $this->fillParam($data, 'id', '');
34
35 1
            $ret .= '<div class="videoWrapper">' . "\n";
36
37 1
            $ret .= '  <iframe width="560" height="349" src="http://www.youtube.com/embed/' . $this->e($vid) . '" frameborder="0">';
38
39 1
        } else {
40 1
            $ret .= '</iframe>' . "\n" . '</div>' . "\n\n";
41
        }
42
43 1
        return $ret;
44
    }
45
}
46