Passed
Pull Request — master (#1022)
by Diego
02:37
created

Select2   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

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