SetAttribute   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
cbo 2
dl 0
loc 15
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

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