| Conditions | 6 |
| Paths | 10 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6.6829 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 1 | private function getCallingClassName() |
|
| 30 | { |
||
| 31 | 1 | $trace = debug_backtrace(); |
|
| 32 | 1 | $loggerFound = false; |
|
| 33 | 1 | $classIndex = 2; |
|
| 34 | 1 | foreach ($trace as $index => $traceData) { |
|
| 35 | 1 | if (true === $loggerFound) { |
|
| 36 | // If Logger hash been found and current class it not Logger (in case of internal calls) |
||
| 37 | if (Logger::class !== $traceData['class']) { |
||
| 38 | $classIndex = $index; |
||
| 39 | break; |
||
| 40 | } |
||
| 41 | } else { |
||
| 42 | 1 | $loggerFound = isset($traceData['class']) && Logger::class == $traceData['class']; |
|
| 43 | } |
||
| 44 | 1 | } |
|
| 45 | |||
| 46 | 1 | return isset($trace[$classIndex]['class']) |
|
| 47 | 1 | ? preg_replace('#(?:[^\\\]+\\\)#', '', $trace[$classIndex]['class']) |
|
| 48 | 1 | : 'UNDEFINED'; |
|
| 49 | } |
||
| 50 | } |
||
| 51 |