Passed
Pull Request — master (#721)
by Florian
02:44
created

Callout   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 14
c 2
b 1
f 0
dl 0
loc 69
ccs 13
cts 13
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A render() 0 3 1
A makeCalloutClass() 0 9 2
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class Callout extends Component
8
{
9
    /**
10
     * The callout icon (a Font Awesome icon).
11
     *
12
     * @var string
13
     */
14
    public $icon;
15
16
    /**
17
     * The callout theme (info, success, warning or danger).
18
     *
19
     * @var string
20
     */
21
    public $theme;
22
23
    /**
24
     * The callout title.
25
     *
26
     * @var string
27
     */
28
    public $title;
29
30
    /**
31
     * Extra classes for the title container. This provides a way to customize
32
     * the title style.
33
     *
34
     * @var string
35
     */
36
    public $titleClass;
37
38
    /**
39
     * Create a new component instance.
40
     *
41
     * @return void
42
     */
43 2
    public function __construct(
44
        $theme = null, $icon = null, $title = null, $titleClass = null
45
    ) {
46 2
        $this->theme = $theme;
47 2
        $this->icon = $icon;
48 2
        $this->title = $title;
49 2
        $this->titleClass = $titleClass;
50 2
    }
51
52
    /**
53
     * Make the class attribute for the callout item.
54
     *
55
     * @return string
56
     */
57 1
    public function makeCalloutClass()
58
    {
59 1
        $classes = ['callout'];
60
61 1
        if (! empty($this->theme)) {
62 1
            $classes[] = "callout-{$this->theme}";
63
        }
64
65 1
        return implode(' ', $classes);
66
    }
67
68
    /**
69
     * Get the view / contents that represent the component.
70
     *
71
     * @return \Illuminate\View\View|string
72
     */
73 1
    public function render()
74
    {
75 1
        return view('adminlte::components.callout');
76
    }
77
}
78