Conditions | 4 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 1 | public function getMessage() |
|
34 | { |
||
35 | 1 | $html = null; |
|
36 | // Print messages |
||
37 | 1 | if (!empty($this->message) && $this->message !== '') { |
|
38 | 1 | $html = '<div id="messagebox">'; |
|
39 | 1 | foreach ($this->message as $msg) |
|
40 | { |
||
41 | $html .= ' |
||
42 | 1 | <div class="message '.htmlentities($msg["type"]).'"> |
|
43 | 1 | <p>'.htmlentities($msg["msg"]).'</p> |
|
44 | 1 | </div>'; |
|
45 | 1 | } |
|
46 | 1 | $html .= '</div>'; |
|
47 | 1 | } |
|
48 | 1 | return $html; |
|
49 | } |
||
50 | } |
||
51 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: