YouTubeRule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 21 2
1
<?php
2
3
namespace Kaloa\Renderer\Xml\Rule;
4
5
use Kaloa\Renderer\Xml\Rule\AbstractRule;
6
7
/**
8
 *
9
 */
10
final class YouTubeRule extends AbstractRule
11
{
12
    /**
13
     *
14
     */
15 1
    public function render()
16
    {
17 1
        foreach ($this->runXpathQuery('//youtube') as $node) {
18
            /* @var $node DOMElement */
19 1
            $parent = $node->parentNode;
20
21 1
            $fragment = $this->getDocument()->createDocumentFragment();
22
23 1
            $id = $node->getAttribute('id');
24
25
            $xml = <<<EOT
26
<div class="videoWrapper">
27
<iframe src="http://www.youtube.com/embed/$id" frameborder="0"></iframe>
28 1
</div>
29 1
EOT;
30
31 1
            $fragment->appendXML($xml);
32
33 1
            $parent->replaceChild($fragment, $node);
34 1
        }
35 1
    }
36
}
37