Passed
Pull Request — master (#721)
by Florian
09:26
created

InfoBox   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A background() 0 3 3
A foreground() 0 3 3
A render() 0 3 1
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class InfoBox extends Component
8
{
9
    public $bg, $icon, $title, $text, $full, $grad;
10
    public $id, $progress, $comment;
11
12
    public function __construct(
13
        $bg = 'info', $icon = 'fas fa-star', $id = null,
14
        $title, $text, $full = false, $grad = false,
15
        $progress = false, $comment = false)
16
    {
17
        $this->id = $id;
18
        $this->bg = $bg;
19
        $this->icon = $icon;
20
        $this->title = $title;
21
        $this->text = $text;
22
        $this->full = $full;
23
        $this->grad = $grad;
24
        $this->progress = $progress;
25
        $this->comment = $comment;
26
    }
27
28
    public function background()
29
    {
30
        return $this->full ?  ($this->grad ? 'bg-gradient-' : 'bg-').$this->bg : '';
31
    }
32
33
    public function foreground()
34
    {
35
        return !$this->full ?  ($this->grad ? 'bg-gradient-' : 'bg-').$this->bg : '';
36
    }
37
38
    public function render()
39
    {
40
        return view('adminlte::info-box');
41
    }
42
}
43