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

Alert   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 7

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A __construct() 0 5 1
A icon() 0 9 5
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class Alert extends Component
8
{
9
    public $type, $title;
10
    public $dismissable;
11
12
    public function __construct($type = 'info', $dismissable = false, $title = 'Alert')
13
    {
14
        $this->type = $type;
15
        $this->title = $title;
16
        $this->dismissable = $dismissable;
17
    }
18
19
    public function icon()
20
    {
21
        switch($this->type)
22
        {
23
            case 'info' : return 'info' ; break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
24
            case 'warning' : return 'exclamation-triangle' ; break;
25
            case 'success' : return 'check' ; break;
26
            case 'danger' : return 'ban' ; break;
27
            default : return 'exclamation'; break;
28
        }
29
    }
30
31
    public function render()
32
    {
33
        return view('adminlte::alert');
34
    }
35
}