Passed
Pull Request — master (#832)
by Florian
09:14
created

Select   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 41
rs 10
c 1
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A render() 0 3 1
A makeItemClass() 0 9 3
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
class Select extends InputGroupComponent
6
{
7
    /**
8
     * Create a new component instance.
9
     *
10
     * @return void
11
     */
12
    public function __construct(
13
        $name, $label = null, $size = null,
14
        $labelClass = null, $topClass = null, $disableFeedback = null
15
    ) {
16
        parent::__construct(
17
            $name, $label, $size, $labelClass, $topClass, $disableFeedback
18
        );
19
    }
20
21
    /**
22
     * Make the class attribute for the input group item.
23
     *
24
     * @param string $invalid
25
     * @return string
26
     */
27
    public function makeItemClass($invalid)
28
    {
29
        $classes = ['form-control', 'w-100'];
30
31
        if (! empty($invalid) && ! isset($this->disableFeedback)) {
32
            $classes[] = 'is-invalid';
33
        }
34
35
        return implode(' ', $classes);
36
    }
37
38
    /**
39
     * Get the view / contents that represent the component.
40
     *
41
     * @return \Illuminate\View\View|string
42
     */
43
    public function render()
44
    {
45
        return view('adminlte::components.select');
46
    }
47
}
48