Passed
Pull Request — master (#721)
by Florian
05:48
created

InputSlider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 9
dl 0
loc 48
ccs 9
cts 9
cp 1
rs 10
c 2
b 1
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A __construct() 0 14 2
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
class InputSlider extends InputGroupComponent
6
{
7
    /**
8
     * The bootstrap-slider plugin configuration parameters. Array with
9
     * key => value pairs, where the key should be an existing configuration
10
     * property of the plugin.
11
     *
12
     * @var array
13
     */
14
    public $config;
15
16
    /**
17
     * The slider color. One of the available html colors.
18
     *
19
     * @var string
20
     */
21
    public $color;
22
23
    /**
24
     * Create a new component instance.
25
     * Note this component requires the 'bootstrap-slider' plugin.
26
     *
27
     * @return void
28
     */
29 1
    public function __construct(
30
        $name, $label = null, $size = null, $labelClass = null,
31
        $topClass = null, $disableFeedback = null, $config = [], $color = null
32
    ) {
33 1
        parent::__construct(
34 1
            $name, $label, $size, $labelClass, $topClass, $disableFeedback
35
        );
36
37 1
        $this->config = is_array($config) ? $config : [];
38 1
        $this->color = $color;
39
40
        // Set a default plugin 'id' option.
41
42 1
        $this->config['id'] = $this->config['id'] ?? "{$name}-slider";
43 1
    }
44
45
    /**
46
     * Get the view / contents that represent the component.
47
     *
48
     * @return \Illuminate\View\View|string
49
     */
50 1
    public function render()
51
    {
52 1
        return view('adminlte::components.input-slider');
53
    }
54
}
55