| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) |
||
| 26 | { |
||
| 27 | if (!$block instanceof TableCaption) { |
||
| 28 | throw new \InvalidArgumentException('Incompatible block type: '.get_class($block)); |
||
| 29 | } |
||
| 30 | |||
| 31 | $attrs = []; |
||
| 32 | foreach ($block->getData('attributes', []) as $key => $value) { |
||
| 33 | $attrs[$key] = Xml::escape($value); |
||
| 34 | } |
||
| 35 | |||
| 36 | if ($block->id) { |
||
|
|
|||
| 37 | $attrs['id'] = $block->id; |
||
| 38 | } |
||
| 39 | |||
| 40 | return new HtmlElement('caption', $attrs, $htmlRenderer->renderInlines($block->children())); |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: