CaptureAttribute   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;
5
use Goetas\Twital\Compiler;
6
7
/**
8
 *
9
 * @author Asmir Mustafic <[email protected]>
10
 *
11
 */
12
class CaptureAttribute implements Attribute
13
{
14 1
    public function visit(\DOMAttr $att, Compiler $context)
15
    {
16 1
        $node = $att->ownerElement;
17
18 1
        $pi = $context->createControlNode("set " . html_entity_decode($att->value));
19 1
        $node->parentNode->insertBefore($pi, $node);
20
21 1
        $pi = $context->createControlNode("endset");
22
23 1
        $node->parentNode->insertBefore($pi, $node->nextSibling); // insert after
24
25 1
        $node->removeAttributeNode($att);
26 1
    }
27
}
28