Passed
Push — master ( 5cded9...9f728c )
by Diego
02:41
created

Select2   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 40
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 2
A render() 0 3 1
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components\Form;
4
5
class Select2 extends InputGroupComponent
6
{
7
    /**
8
     * The select2 plugin configuration parameters. Array with key => value
9
     * pairs, where the key should be an existing configuration property of
10
     * the select2 plugin.
11
     *
12
     * @var array
13
     */
14
    public $config;
15
16
    /**
17
     * Create a new component instance.
18
     * Note this component requires the 'select2' plugin and the 'bootstrap4'
19
     * css theme.
20
     *
21
     * @return void
22
     */
23 2
    public function __construct(
24
        $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
25
        $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
26
        $errorKey = null, $config = []
27
    ) {
28 2
        parent::__construct(
29 2
            $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
30
            $igroupClass, $disableFeedback, $errorKey
31
        );
32
33 2
        $this->config = is_array($config) ? $config : [];
34 2
        $this->config['theme'] = 'bootstrap4';
35 2
    }
36
37
    /**
38
     * Get the view / contents that represent the component.
39
     *
40
     * @return \Illuminate\View\View|string
41
     */
42 1
    public function render()
43
    {
44 1
        return view('adminlte::components.form.select2');
45
    }
46
}
47