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