Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 126 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false) |
|
32 | { |
||
33 | 126 | if (!($block instanceof Heading)) { |
|
34 | 3 | throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block)); |
|
35 | } |
||
36 | |||
37 | 123 | $tag = 'h' . $block->getLevel(); |
|
38 | |||
39 | 123 | $attrs = []; |
|
40 | 123 | foreach ($block->getData('attributes', []) as $key => $value) { |
|
41 | 18 | $attrs[$key] = $htmlRenderer->escape($value, true); |
|
42 | 123 | } |
|
43 | |||
44 | 123 | return new HtmlElement($tag, $attrs, $htmlRenderer->renderInlines($block->children())); |
|
45 | } |
||
46 | } |
||
47 |