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

Callout::makeCalloutClass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
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