ReplaceAttribute   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A visit() 0 10 1
1
<?php
2
namespace Goetas\Twital\Attribute;
3
4
use Goetas\Twital\Attribute;
5
use Goetas\Twital\Compiler;
6
7
/**
8
 *
9
 * @author Asmir Mustafic <[email protected]>
10
 *
11
 */
12
class ReplaceAttribute implements Attribute
13
{
14 3
    public function visit(\DOMAttr $att, Compiler $context)
15
    {
16 3
        $node = $att->ownerElement;
17 3
        $pi = $context->createPrintNode(html_entity_decode($att->value));
18
19 3
        $node->parentNode->replaceChild($pi, $node);
20
21 3
        $node->removeAttributeNode($att);
22 3
        return Attribute::STOP_NODE;
23
    }
24
}
25