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