Passed
Push — master ( edc575...08ade3 )
by Bruno
07:00
created

Table   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 25
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 17 3
A getMetadata() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Buefy\Element;
4
5
use Formularium\Element;
6
use Formularium\HTMLNode;
7
use Formularium\Metadata;
8
use Formularium\MetadataParameter;
9
use Formularium\Frontend\HTML\Element\Table as HTMLTable;
10
11
class Table extends Element
12
{
13
    public function render(array $parameters, HTMLNode $previous): HTMLNode
14
    {
15
        $node = HTMLNode::factory(
16
            'b-table',
17
            [
18
                ':data' => 'data', // TODO
19
                ':columns' => 'columns'
20
            ]
21
        );
22
        if ($parameters[HTMLTable::STRIPED] ?? false) {
23
            $node->addAttribute(':striped', 'true');
24
        }
25
        if ($parameters[HTMLTable::BORDERED] ?? false) {
26
            $node->addAttribute(':bordered', 'true');
27
        }
28
29
        return $node;
30
    }
31
32
    public static function getMetadata(): Metadata
33
    {
34
        $metadata = HTMLTable::getMetadata();
35
        return $metadata;
36
    }
37
}
38