Passed
Push — master ( 8f6522...eef865 )
by Florian
06:34
created

ProfileRowItem::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 6
dl 0
loc 10
ccs 7
cts 7
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
7
class ProfileRowItem extends Component
8
{
9
    /**
10
     * The title/header for the item.
11
     *
12
     * @var string
13
     */
14
    public $title;
15
16
    /**
17
     * The text/description for the item.
18
     *
19
     * @var string
20
     */
21
    public $text;
22
23
    /**
24
     * A Font Awesome icon for the item.
25
     *
26
     * @var string
27
     */
28
    public $icon;
29
30
    /**
31
     * The item size. Used to wrap the item inside a col-size div.
32
     *
33
     * @var int
34
     */
35
    public $size;
36
37
    /**
38
     * The badge theme for the text attribute. When used, the text attribute
39
     * will be wrapped inside a badge of the configured theme. Available themes
40
     * are: light, dark, primary, secondary, info, success, warning, danger or
41
     * any other AdminLTE color like lighblue or teal.
42
     *
43
     * @var string
44
     */
45
    public $badge;
46
47
    /**
48
     * Setup an url for the item. When enabled the title attribute will be
49
     * wrapped inside a link pointing to that url.
50
     *
51
     * @var string
52
     */
53
    public $url;
54
55
    /**
56
     * Create a new component instance.
57
     *
58
     * @return void
59
     */
60 2
    public function __construct(
61
        $title = null, $text = null, $icon = null, $size = 12,
62
        $badge = null, $url = null
63
    ) {
64 2
        $this->title = $title;
65 2
        $this->text = $text;
66 2
        $this->icon = $icon;
67 2
        $this->size = $size;
68 2
        $this->badge = $badge;
69 2
        $this->url = $url;
70 2
    }
71
72
    /**
73
     * Make the text wrapper class.
74
     *
75
     * @return string
76
     */
77 1
    public function makeTextWrapperClass()
78
    {
79 1
        $classes = ['float-right'];
80
81 1
        if (isset($this->badge)) {
82 1
            $classes[] = "badge bg-{$this->badge}";
83
        }
84
85 1
        return implode(' ', $classes);
86
    }
87
88
    /**
89
     * Get the view / contents that represent the component.
90
     *
91
     * @return \Illuminate\View\View|string
92
     */
93 1
    public function render()
94
    {
95 1
        return view('adminlte::components.widget.profile-row-item');
96
    }
97
}
98