Conditions | 5 |
Paths | 7 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
25 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) |
||
26 | { |
||
27 | if (!$block instanceof TableCell) { |
||
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->align) { |
||
|
|||
37 | $attrs['style'] = (isset($attrs['style']) ? $attrs['style'].' ' : '').'text-align: '.$block->align; |
||
38 | } |
||
39 | |||
40 | return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); |
||
41 | } |
||
42 | } |
||
43 |
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: