| Total Complexity | 25 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Coverage | 95.65% |
| Changes | 3 | ||
| Bugs | 3 | Features | 0 |
| 1 | <?php |
||
| 11 | class Log implements HandlerInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var LoggerInterface|null |
||
| 15 | */ |
||
| 16 | protected $logger; |
||
| 17 | |||
| 18 | 79 | public function __construct(LoggerInterface $logger = null) |
|
| 19 | { |
||
| 20 | 79 | if (null !== $logger) { |
|
| 21 | 6 | $this->setLogger($logger); |
|
| 22 | } |
||
| 23 | 79 | } |
|
| 24 | |||
| 25 | 14 | public function setLogger(LoggerInterface $logger): self |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param Exception $exception |
||
| 34 | */ |
||
| 35 | 6 | public function handle($exception): void |
|
| 36 | { |
||
| 37 | 6 | if ($exception instanceof ErrorException) { |
|
| 38 | 4 | $this->handleErrorException($exception); |
|
| 39 | |||
| 40 | 4 | return; |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | if ($this->logger) { |
|
| 44 | 2 | $this->logger->critical($this->buildLogMessage($exception)); |
|
| 45 | } |
||
| 46 | 2 | } |
|
| 47 | |||
| 48 | 4 | protected function handleErrorException(ErrorException $exception): bool |
|
| 80 | } |
||
| 81 | |||
| 82 | 6 | protected function buildLogMessage(Exception $exception): string |
|
| 93 | } |
||
| 94 | } |
||
| 95 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.