| Conditions | 5 |
| Paths | 7 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.1502 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 17 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false) |
|
| 24 | { |
||
| 25 | 17 | if (!$block instanceof TableCell) { |
|
| 26 | throw new \InvalidArgumentException('Incompatible block type: '.get_class($block)); |
||
| 27 | } |
||
| 28 | |||
| 29 | 17 | $attrs = []; |
|
| 30 | 17 | foreach ($block->getData('attributes', []) as $key => $value) { |
|
| 31 | $attrs[$key] = Xml::escape($value, true); |
||
| 32 | } |
||
| 33 | |||
| 34 | 17 | if ($block->align) { |
|
| 35 | 4 | if ($block->type == TableCell::TYPE_HEAD) { |
|
| 36 | 4 | $attrs['style'] = "text-align: $block->align"; |
|
| 37 | } else { |
||
| 38 | 4 | $attrs['align'] = $block->align; |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 17 | return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); |
|
|
|
|||
| 43 | } |
||
| 44 | } |
||
| 45 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: