| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 9 | public static function extractPsrLogger(Logger $logger) |
|
| 23 | { |
||
| 24 | 9 | $writers = $logger->getWriters()->toArray(); |
|
| 25 | |||
| 26 | 9 | $psrWriter = static::findPsrWriter($writers); |
|
|
|
|||
| 27 | |||
| 28 | 9 | if (!$psrWriter) { |
|
| 29 | 3 | throw new NoPsrLoggerAvailable(); |
|
| 30 | } |
||
| 31 | |||
| 32 | 6 | $reflectionClass = new ReflectionClass($psrWriter); |
|
| 33 | |||
| 34 | 6 | $loggerProperty = $reflectionClass->getProperty('logger'); |
|
| 35 | 6 | $loggerProperty->setAccessible(true); |
|
| 36 | |||
| 37 | 6 | return $loggerProperty->getValue($psrWriter); |
|
| 38 | } |
||
| 39 | |||
| 51 |
Late static binding only has effect in subclasses. A
finalclass cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::withself::.To learn more about late static binding, please refer to the PHP core documentation.