| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 6 | public function visit(\DOMAttr $att, Compiler $context) |
|
| 18 | { |
||
| 19 | 6 | $node = $att->ownerElement; |
|
| 20 | 6 | $node->removeAttributeNode($att); |
|
| 21 | |||
| 22 | // create sandbox |
||
| 23 | 6 | $sandbox = $node->ownerDocument->createElementNS(Twital::NS, "sandbox"); |
|
| 24 | 6 | $node->parentNode->insertBefore($sandbox, $node); |
|
| 25 | |||
| 26 | // move to sandbox |
||
| 27 | 6 | $node->parentNode->removeChild($node); |
|
| 28 | 6 | $sandbox->appendChild($node); |
|
| 29 | |||
| 30 | 6 | $context->compileAttributes($node); |
|
| 31 | 6 | $context->compileChilds($node); |
|
| 32 | |||
| 33 | |||
| 34 | 6 | $start = $context->createControlNode("block " . $att->value); |
|
| 35 | 6 | $end = $context->createControlNode("endblock"); |
|
| 36 | |||
| 37 | 6 | $sandbox->insertBefore($start, $sandbox->firstChild); |
|
| 38 | 6 | $sandbox->appendChild($end); |
|
| 39 | |||
| 40 | 6 | DOMHelper::replaceWithSet($sandbox, iterator_to_array($sandbox->childNodes)); |
|
| 41 | 6 | } |
|
| 42 | } |
||
| 43 |