| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2.004 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 3 | public function visit(\DOMElement $node, Compiler $context) |
|
| 17 | { |
||
| 18 | 3 | if (!$node->hasAttribute("name")) { |
|
| 19 | throw new Exception("Name attribute is required"); |
||
| 20 | } |
||
| 21 | |||
| 22 | 3 | $context->compileChilds($node); |
|
| 23 | |||
| 24 | 3 | $set = iterator_to_array($node->childNodes); |
|
| 25 | |||
| 26 | 3 | $start = $context->createControlNode("macro " . $node->getAttribute("name") . "(" . $node->getAttribute("args") . ")"); |
|
| 27 | 3 | array_unshift($set, $start); |
|
| 28 | |||
| 29 | 3 | $set[] = $context->createControlNode("endmacro"); |
|
| 30 | |||
| 31 | 3 | DOMHelper::replaceWithSet($node, $set); |
|
| 32 | 3 | } |
|
| 33 | } |
||
| 34 |