Passed
Push — master ( 31045a...52c533 )
by Bruno
06:54
created

Renderable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 8
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A container() 0 11 3
1
<?php
2
3
namespace Formularium\Frontend\HTML;
4
5
use Formularium\Field;
6
use Formularium\HTMLElement;
7
8
abstract class Renderable extends \Formularium\Renderable implements \Formularium\Frontend\HTML\RenderableInterface
9
{
10
    protected function container($content, Field $field)
11
    {
12
        $extensions = $field->getExtensions();
13
        $container = new HTMLElement(Framework::getEditableContainerTag(), [], $content);
14
        if (array_key_exists('label', $extensions)) {
15
            $container->prependContent(new HTMLElement('label', ['for' => $content->getAttribute('id')], $extensions['label']));
16
        }
17
        if (array_key_exists('comment', $extensions)) {
18
            $container->appendContent(new HTMLElement('div', ['class' => 'comment'], $extensions['comment']));
19
        }
20
        return $container;
21
    }
22
}
23