Conditions | 6 |
Paths | 13 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function alertBox(array $message) |
||
|
|||
12 | { |
||
13 | if(!$message){return false;} |
||
14 | if(count($message) < 2) { |
||
15 | $class = 'info'; |
||
16 | } else { |
||
17 | $class = array_pop($message); |
||
18 | } |
||
19 | |||
20 | $alert = '<div class="alert '; |
||
21 | if($class != 'alert'){$alert .= 'alert-'.$class;} |
||
22 | $alert .= '"><button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
||
23 | <span aria-hidden="true">×</span> |
||
24 | </button>'; |
||
25 | |||
26 | $num = count($message); |
||
27 | $x = 1; |
||
28 | foreach($message as $msg) |
||
29 | { |
||
30 | $alert .= $msg; |
||
31 | if($x < $num){$alert .= '<br />';} |
||
32 | $x ++; |
||
33 | } |
||
34 | $alert .= '</div>'; |
||
35 | return $alert; |
||
36 | } |
||
37 | } |