| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public static function generateCallTrace($exception = null) |
||
| 8 | { |
||
| 9 | if (is_null($exception)) { |
||
| 10 | $exception = new Exception(); |
||
| 11 | } |
||
| 12 | $trace = explode("\n", $exception->getTraceAsString()); |
||
| 13 | // reverse array to make steps line up chronologically |
||
| 14 | // // $trace = array_reverse($trace); |
||
| 15 | array_shift($trace); // remove {main} |
||
| 16 | array_pop($trace); // remove call to this method |
||
| 17 | $length = count($trace); |
||
| 18 | $result = []; |
||
| 19 | |||
| 20 | for ($i = 0; $i < $length; ++$i) { |
||
| 21 | $result[] = ($i + 1).')'.substr($trace[$i], strpos($trace[$i], ' ')); // replace '#someNum' with '$i)', set the right ordering |
||
| 22 | } |
||
| 23 | |||
| 24 | return "\t".implode("\n\t", $result); |
||
| 25 | } |
||
| 26 | |||
| 37 |