| Conditions | 5 |
| Paths | 7 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.1502 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 16 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false) |
|
| 23 | { |
||
| 24 | 16 | if (!($block instanceof TableCell)) { |
|
| 25 | throw new \InvalidArgumentException('Incompatible block type: '.get_class($block)); |
||
| 26 | } |
||
| 27 | |||
| 28 | 16 | $attrs = []; |
|
| 29 | 16 | foreach ($block->getData('attributes', []) as $key => $value) { |
|
| 30 | $attrs[$key] = $htmlRenderer->escape($value, true); |
||
| 31 | } |
||
| 32 | |||
| 33 | 16 | if ($block->align) { |
|
| 34 | 4 | if ($block->type == TableCell::TYPE_HEAD) { |
|
| 35 | 4 | $attrs['style'] = "text-align: $block->align"; |
|
| 36 | } else { |
||
| 37 | 4 | $attrs['align'] = $block->align; |
|
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | 16 | return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); |
|
|
|
|||
| 42 | } |
||
| 43 | } |
||
| 44 |
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: