Completed
Push — twig-2 ( 3d05b1...e1f2a0 )
by Asmir
08:25 queued 02:17
created

ReplaceAttribute   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
cbo 1
dl 0
loc 13
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
use Goetas\Twital\Helper\DOMHelper;
7
8
/**
9
 *
10
 * @author Asmir Mustafic <[email protected]>
11
 *
12
 */
13
class ReplaceAttribute implements Attribute
14
{
15
    public function visit(\DOMAttr $att, Compiler $context)
16
    {
17
        $node = $att->ownerElement;
18
        $pi = $context->createPrintNode(html_entity_decode($att->value));
19
20
        $node->parentNode->replaceChild($pi, $node);
21
22
        $node->removeAttributeNode($att);
23
        return Attribute::STOP_NODE;
24
    }
25
}
26