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