Callout::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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