Test Failed
Push — master ( e97986...2933e0 )
by Bruno
19:41 queued 09:43
created

Card   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 32 3
A getMetadata() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Vuetify\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 VuetifyElement
11
{
12
    public function render(array $parameters, HTMLNode $previous): HTMLNode
13
    {
14
        $atts = [
15
            'class' => 'formularium-card'
16
        ];
17
18
        $contents = [];
19
20
        if ($parameters[HTMLCard::IMAGE] ?? '') {
21
            $contents[] = new HTMLNode(
22
                'v-img',
23
                [
24
                    'src' => $parameters[HTMLCard::IMAGE] ?? '',
25
                ]
26
            );
27
        }
28
29
        if ($parameters[HTMLCard::TITLE] ?? '') {
30
            $contents[] = new HTMLNode(
31
                'v-card-title',
32
                [],
33
                $parameters[HTMLCard::TITLE] ?? ''
34
            );
35
        }
36
37
        return new HTMLNode(
38
            'v-card',
39
            $atts,
40
            new HTMLNode(
41
                'v-card-text',
42
                [],
43
                $parameters[HTMLCard::CONTENT] ?? ''
44
            )
45
        );
46
    }
47
48
    public static function getMetadata(): Metadata
49
    {
50
        $metadata = HTMLCard::getMetadata();
51
        return $metadata;
52
    }
53
}
54