| Conditions | 6 |
| Paths | 12 |
| Total Lines | 36 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function render(array $data = []): string |
||
| 14 | { |
||
| 15 | $title = $data['title']; |
||
| 16 | $padding = $data['padding']; |
||
| 17 | $isFieldset = $data['is_fieldset']; |
||
| 18 | $request = $data['request']; |
||
| 19 | |||
| 20 | /** @var AdminComponentInterface[] $components */ |
||
| 21 | $components = $data['components']; |
||
| 22 | |||
| 23 | $html = ''; |
||
| 24 | |||
| 25 | $titleElement = $this->tag('h3', [], $title); |
||
| 26 | $attributes = ['class' => "py-{$padding}"]; |
||
| 27 | $container = $isFieldset ? 'fieldset' : 'div'; |
||
| 28 | |||
| 29 | $html .= $this->open($container, $attributes); |
||
| 30 | |||
| 31 | if ($isFieldset && false) { // @phpstan-ignore-line |
||
| 32 | // temporarily disabled because legend elements are absolutely |
||
| 33 | // positioned within their container, making padding not work |
||
| 34 | // as desired |
||
| 35 | $html .= $this->tag('legend', [], $titleElement); |
||
| 36 | } else { |
||
| 37 | $html .= $titleElement; |
||
| 38 | } |
||
| 39 | |||
| 40 | foreach ($components as $component) { |
||
| 41 | if ($component->shouldBeRendered($request)) { |
||
| 42 | $html .= $component->renderComponent($request); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | $html .= $this->close($container); |
||
| 47 | |||
| 48 | return $html; |
||
| 49 | } |
||
| 51 |