| Total Complexity | 3 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 70% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class CommandHandlerLogger |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var LoggerInterface |
||
| 21 | */ |
||
| 22 | protected $logger; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Logger constructor. |
||
| 26 | * |
||
| 27 | * @param LoggerInterface $logger |
||
| 28 | */ |
||
| 29 | 37 | public function __construct(LoggerInterface $logger) |
|
| 32 | 37 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @param CommandHandler $commandHandler |
||
| 36 | * @param string $message |
||
| 37 | * @param string $level |
||
| 38 | */ |
||
| 39 | 33 | public function log(CommandHandler $commandHandler, $message, $level = 'info') |
|
| 40 | { |
||
| 41 | 33 | $msg = '['.get_class($commandHandler).'] ' . $message; |
|
| 42 | 33 | $this->logger->{$level}($msg); |
|
| 43 | 33 | } |
|
| 44 | |||
| 45 | /** |
||
| 46 | * @param \Exception $exception |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function logExceptionAndReturnFalse(\Exception $exception) |
||
| 54 | } |
||
| 55 | } |
||
| 56 |