fractalzombie /
frzb-metrics-power
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /** |
||
| 6 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||
| 7 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
| 8 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
||
| 9 | * |
||
| 10 | * Copyright (c) 2024 Mykhailo Shtanko [email protected] |
||
| 11 | * |
||
| 12 | * For the full copyright and license information, please view the LICENSE.MD |
||
| 13 | * file that was distributed with this source code. |
||
| 14 | */ |
||
| 15 | |||
| 16 | namespace FRZB\Component\MetricsPower\Logger; |
||
| 17 | |||
| 18 | use FRZB\Component\DependencyInjection\Attribute\AsService; |
||
| 19 | use Psr\Log\LoggerInterface; |
||
| 20 | |||
| 21 | #[AsService] |
||
| 22 | class MetricsPowerLogger implements MetricsPowerLoggerInterface |
||
| 23 | { |
||
| 24 | public function __construct( |
||
| 25 | private readonly ContextExtractorLocatorInterface $contextExtractorLocator, |
||
| 26 | private readonly LoggerInterface $logger, |
||
| 27 | ) {} |
||
| 28 | |||
| 29 | public function info(object $target): void |
||
| 30 | { |
||
| 31 | $context = $this->contextExtractorLocator |
||
| 32 | ->get($target::class) |
||
| 33 | ->extract($target); |
||
|
0 ignored issues
–
show
|
|||
| 34 | |||
| 35 | $this->logger->info($context->message, $context->context); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function error(object $target, \Throwable $exception): void |
||
| 39 | { |
||
| 40 | $context = $this->contextExtractorLocator |
||
| 41 | ->get($target::class) |
||
| 42 | ->extract($target); |
||
| 43 | |||
| 44 | $this->logger->error($context->message, $context->context); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
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.