| Total Complexity | 10 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 95.24% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Logger |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var array<string,array<integer,mixed>> |
||
| 11 | */ |
||
| 12 | private array $entries = []; |
||
| 13 | |||
| 14 | 108 | public function __construct() |
|
| 15 | { |
||
| 16 | 108 | $this->entries = [ |
|
| 17 | 108 | 'error' => [], |
|
| 18 | 108 | 'warning' => [], |
|
| 19 | 108 | ]; |
|
| 20 | } |
||
| 21 | |||
| 22 | 11 | public function error(string $message, array $context = []): void |
|
| 23 | { |
||
| 24 | 11 | $this->log('error', $message, $context); |
|
| 25 | } |
||
| 26 | |||
| 27 | 5 | public function warning(string $message, array $context = []): void |
|
| 28 | { |
||
| 29 | 5 | $this->log('warning', $message, $context); |
|
| 30 | } |
||
| 31 | |||
| 32 | 11 | private function log($level, $message, array $context = []): void |
|
| 39 | } |
||
| 40 | |||
| 41 | 104 | public function getEntries(?string $level = null): array |
|
| 50 | } |
||
| 51 | |||
| 52 | 10 | public function hasEntries(?string $level = null): bool |
|
| 55 | } |
||
| 56 | } |
||
| 57 |