Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.0466 |
Changes | 0 |
1 | <?php |
||
25 | 34 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) |
|
26 | { |
||
27 | 34 | if (!$block instanceof TableCell) { |
|
28 | throw new \InvalidArgumentException('Incompatible block type: '.get_class($block)); |
||
29 | } |
||
30 | |||
31 | 34 | $attrs = $block->getData('attributes', []); |
|
32 | |||
33 | 34 | if ($block->align) { |
|
|
|||
34 | 8 | $attrs['style'] = (isset($attrs['style']) ? $attrs['style'].' ' : '').'text-align: '.$block->align; |
|
35 | } |
||
36 | |||
37 | 34 | return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); |
|
38 | } |
||
39 | } |
||
40 |
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: