Passed
Pull Request — master (#721)
by Florian
14:00 queued 04:02
created

InfoBox::foreground()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 1
c 1
b 0
f 0
nc 4
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class InfoBox extends Component
8
{
9
    public $bg;
10
    public $icon;
11
    public $title;
12
    public $text;
13
    public $full;
14
    public $grad;
15
    public $id;
16
    public $progress;
17
    public $comment;
18
19
    public function __construct(
20
        $bg = 'info', $icon = 'fas fa-star', $id = null,
21
        $title, $text, $full = false, $grad = false,
22
        $progress = false, $comment = false)
23
    {
24
        $this->id = $id;
25
        $this->bg = $bg;
26
        $this->icon = $icon;
27
        $this->title = $title;
28
        $this->text = $text;
29
        $this->full = $full;
30
        $this->grad = $grad;
31
        $this->progress = $progress;
32
        $this->comment = $comment;
33
    }
34
35
    public function background()
36
    {
37
        return $this->full ? ($this->grad ? 'bg-gradient-' : 'bg-').$this->bg : '';
38
    }
39
40
    public function foreground()
41
    {
42
        return ! $this->full ? ($this->grad ? 'bg-gradient-' : 'bg-').$this->bg : '';
43
    }
44
45
    public function render()
46
    {
47
        return view('adminlte::info-box');
48
    }
49
}
50