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