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

Upload::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 12
rs 10
c 1
b 0
f 0
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