Total Complexity | 7 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | class Alert extends Component |
||
8 | { |
||
9 | public $type; |
||
10 | public $title; |
||
11 | public $dismissable; |
||
12 | |||
13 | 2 | public function __construct($type = 'info', $dismissable = false, $title = 'Alert') |
|
14 | { |
||
15 | 2 | $this->type = $type; |
|
16 | 2 | $this->title = $title; |
|
17 | 2 | $this->dismissable = $dismissable; |
|
18 | 2 | } |
|
19 | |||
20 | 1 | public function icon() |
|
21 | { |
||
22 | 1 | switch ($this->type) { |
|
23 | 1 | case 'info': return 'info'; break; |
|
|
|||
24 | 1 | case 'warning': return 'exclamation-triangle'; break; |
|
25 | 1 | case 'success': return 'check'; break; |
|
26 | 1 | case 'danger': return 'ban'; break; |
|
27 | 1 | default: return 'exclamation'; break; |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 1 | public function render() |
|
34 | } |
||
35 | } |
||
36 |
The
break
statement is not necessary if it is preceded for example by areturn
statement: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.