| Conditions | 4 |
| Paths | 6 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function log($level, $message, array $context = array()) |
||
| 26 | { |
||
| 27 | $stamp = date("[Y-m-d H:i:s] "); |
||
| 28 | $output = ""; |
||
| 29 | |||
| 30 | $message = trim($message); |
||
| 31 | |||
| 32 | switch ($level) { |
||
| 33 | case LogLevel::DEBUG: |
||
| 34 | if ($this->debug) { |
||
| 35 | $output = "{$stamp} {$message}"; |
||
| 36 | } |
||
| 37 | break; |
||
| 38 | |||
| 39 | default: |
||
| 40 | $output = "{$stamp} {$message}"; |
||
| 41 | break; |
||
| 42 | } |
||
| 43 | |||
| 44 | echo $output . PHP_EOL; |
||
| 45 | |||
| 46 | if ($context) { |
||
| 47 | var_dump($context); |
||
| 48 | echo PHP_EOL; |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 53 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.