Passed
Push — master ( 5e4c5e...9eef8c )
by Bruno
07:32
created

Upload   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetadata() 0 4 1
A render() 0 12 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Bootstrap\Element;
4
5
use Formularium\Element;
6
use Formularium\HTMLNode;
7
use Formularium\Metadata;
8
use Formularium\Frontend\HTML\Element\Upload as HTMLUpload;
9
10
class Upload extends Element
11
{
12
    public function render(array $parameters, HTMLNode $previous): HTMLNode
13
    {
14
        $previous->addAttribute('class', 'custom-file');
15
        /**
16
         * @var HTMLNode $input
17
         */
18
        $input = $previous->get('input')[0];
19
        $input->addAttribute('class', 'custom-file-input');
20
        $label = $previous->get('label')[0];
21
        $label->addAttribute('class', 'custom-file-label');
22
23
        return $previous;
24
    }
25
26
    public static function getMetadata(): Metadata
27
    {
28
        $metadata = HTMLUpload::getMetadata();
29
        return $metadata;
30
    }
31
}
32