| Conditions | 6 |
| Paths | 10 |
| Total Lines | 25 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | public function Raise($aMsg, $aHalt = false) |
||
| 38 | { |
||
| 39 | if ($this->iDest != '') { |
||
| 40 | if ($this->iDest == 'syslog') { |
||
| 41 | error_log($this->iTitle . $aMsg); |
||
| 42 | } else { |
||
| 43 | $str = '[' . date('r') . '] ' . $this->iTitle . $aMsg . "\n"; |
||
| 44 | $f = @fopen($this->iDest, 'a'); |
||
|
|
|||
| 45 | if ($f) { |
||
| 46 | @fwrite($f, $str); |
||
| 47 | @fclose($f); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } else { |
||
| 51 | $aMsg = $this->iTitle . $aMsg; |
||
| 52 | // Check SAPI and if we are called from the command line |
||
| 53 | // send the error to STDERR instead |
||
| 54 | if (PHP_SAPI == 'cli') { |
||
| 55 | fwrite(STDERR, $aMsg); |
||
| 56 | } else { |
||
| 57 | echo $aMsg; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | if ($aHalt) { |
||
| 61 | exit(1); |
||
| 62 | } |
||
| 65 |