| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 117 | public function render(Node $node, ChildNodeRendererInterface $childRenderer) |
|
| 36 | { |
||
| 37 | 117 | if (! ($node instanceof FencedCode)) { |
|
| 38 | 3 | throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); |
|
| 39 | } |
||
| 40 | |||
| 41 | 114 | $attrs = $node->data->getData('attributes'); |
|
| 42 | |||
| 43 | 114 | $infoWords = $node->getInfoWords(); |
|
| 44 | 114 | if (\count($infoWords) !== 0 && $infoWords[0] !== '') { |
|
| 45 | 24 | $attrs->append('class', 'language-' . $infoWords[0]); |
|
| 46 | } |
||
| 47 | |||
| 48 | 114 | return new HtmlElement( |
|
| 49 | 114 | 'pre', |
|
| 50 | 114 | [], |
|
| 51 | 114 | new HtmlElement('code', $attrs->export(), Xml::escape($node->getLiteral())) |
|
| 52 | ); |
||
| 55 |