Total Complexity | 7 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class SludioLogger |
||
9 | { |
||
10 | protected $logger; |
||
11 | |||
12 | /** |
||
13 | * Constructor. |
||
14 | * |
||
15 | * @param LoggerInterface $logger |
||
16 | * |
||
17 | * @throws InvalidArgumentException |
||
18 | */ |
||
19 | public function __construct($logger = null) |
||
20 | { |
||
21 | if (null !== $logger && !$logger instanceof LoggerInterface) { |
||
22 | throw new InvalidArgumentException(sprintf('SludioLogger needs PSR-3 LoggerInterface, "%s" was injected instead.', \is_object($logger) ? \get_class($logger) : \gettype($logger))); |
||
23 | } |
||
24 | |||
25 | $this->logger = $logger; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Logs a command |
||
30 | * |
||
31 | * @param string $command Sludio command |
||
32 | * @param null|string $error Error message or null |
||
33 | * @param string $type Log type |
||
34 | */ |
||
35 | public function log($command, $error = null, $type = 'info') |
||
38 | } |
||
39 | |||
40 | public function error($command, $error) |
||
43 | } |
||
44 | } |
||
45 |