| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0052 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 9 | public function visit(\DOMElement $node, Compiler $context) |
|
| 16 | { |
||
| 17 | 9 | $code = "use "; |
|
| 18 | |||
| 19 | 9 | if ($node->hasAttribute("from")) { |
|
| 20 | 9 | $code .= '"' . $node->getAttribute("from") . '"'; |
|
| 21 | 9 | } else { |
|
| 22 | throw new Exception("The 'from' attribute is required"); |
||
| 23 | } |
||
| 24 | |||
| 25 | 9 | if ($node->hasAttribute("with")) { |
|
| 26 | 3 | $code .= " with " . $node->getAttribute("with"); |
|
| 27 | 3 | } |
|
| 28 | |||
| 29 | 9 | $pi = $context->createControlNode($code); |
|
| 30 | 9 | $node->parentNode->replaceChild($pi, $node); |
|
| 31 | 9 | } |
|
| 32 | } |
||
| 33 |