Passed
Push — master ( 648548...5e4c5e )
by Bruno
08:25
created

Card   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 15
c 1
b 0
f 1
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 18 1
A getMetadata() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Bootstrapvue\Element;
4
5
use Formularium\Element;
6
use Formularium\Frontend\HTML\Element\Card as HTMLCard;
7
use Formularium\HTMLNode;
8
use Formularium\Metadata;
9
10
class Card extends Element
11
{
12
    public function render(array $parameters, HTMLNode $previous): HTMLNode
13
    {
14
        $atts = [
15
            'title' => $parameters[HTMLCard::TITLE] ?? '',
16
            'img-src' => $parameters[HTMLCard::IMAGE] ?? '',
17
            // img-alt
18
            'img-top' => true, // TODO: position
19
            'tag' => 'article',
20
            'class' => 'formularium-card' // TODO
21
        ];
22
        // TODO: link
23
        return new HTMLNode(
24
            'b-card',
25
            $atts,
26
            new HTMLNode(
27
                'b-card-text',
28
                [],
29
                $parameters[HTMLCard::CONTENT] ?? ''
30
            )
31
        );
32
    }
33
34
    public static function getMetadata(): Metadata
35
    {
36
        $metadata = HTMLCard::getMetadata();
37
        return $metadata;
38
    }
39
}
40