Passed
Push — master ( 8f6522...eef865 )
by Florian
06:34
created

InputFile::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\View\Components\Form;
4
5
class InputFile extends InputGroupComponent
6
{
7
    /**
8
     * The placeholder for the input file box.
9
     *
10
     * @var string
11
     */
12
    public $placeholder;
13
14
    /**
15
     * A legend for replace the default 'Browse' text.
16
     *
17
     * @var string
18
     */
19
    public $legend;
20
21
    /**
22
     * Create a new component instance.
23
     * Note this component requires the 'bs-custom-input-file' plugin.
24
     *
25
     * @return void
26
     */
27 2
    public function __construct(
28
        $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
29
        $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
30
        $errorKey = null, $placeholder = '', $legend = null
31
    ) {
32 2
        parent::__construct(
33 2
            $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
34
            $igroupClass, $disableFeedback, $errorKey
35
        );
36
37 2
        $this->legend = $legend;
38 2
        $this->placeholder = $placeholder;
39 2
    }
40
41
    /**
42
     * Make the class attribute for the input group item.
43
     *
44
     * @return string
45
     */
46 1
    public function makeItemClass()
47
    {
48 1
        $classes = ['custom-file-input'];
49
50 1
        if ($this->isInvalid() && ! isset($this->disableFeedback)) {
51 1
            $classes[] = 'is-invalid';
52
        }
53
54 1
        return implode(' ', $classes);
55
    }
56
57
    /**
58
     * Get the view / contents that represent the component.
59
     *
60
     * @return \Illuminate\View\View|string
61
     */
62 1
    public function render()
63
    {
64 1
        return view('adminlte::components.form.input-file');
65
    }
66
}
67