BaseAttribute   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A visit() 0 13 1
1
<?php
2
namespace Goetas\Twital\Attribute;
3
4
use Goetas\Twital\Attribute as AttributeBase;
5
use Goetas\Twital\Compiler;
6
7
/**
8
 *
9
 * @author Asmir Mustafic <[email protected]>
10
 *
11
 */
12
class BaseAttribute implements AttributeBase
13
{
14 3
    public function visit(\DOMAttr $att, Compiler $context)
15
    {
16 3
        $node = $att->ownerElement;
17
18 3
        $pi = $context->createControlNode("{$att->localName} " . html_entity_decode($att->value));
19 3
        $node->parentNode->insertBefore($pi, $node);
20
21 3
        $pi = $context->createControlNode("end{$att->localName}");
22
23 3
        $node->parentNode->insertBefore($pi, $node->nextSibling); // insert after
24
25 3
        $node->removeAttributeNode($att);
26 3
    }
27
}
28